Skip to content

Commit

Permalink
chore: remove unused conveyor code
Browse files Browse the repository at this point in the history
  • Loading branch information
XOR-op committed May 28, 2024
1 parent c252804 commit 1c8a67c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 20 deletions.
1 change: 0 additions & 1 deletion conveyor/plugin/calculator_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ def compute(self, data: dict):
self.answer = eval(query)
end = time.perf_counter()
self.time += end - start

1 change: 0 additions & 1 deletion conveyor/plugin/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def poll_finished(self, client_id: str) -> Optional[List]:
for plugin in plugin_list:
if plugin.local_pipe.poll():
res = plugin.local_pipe.recv()
# logging.debug(f"[PluginScheduler:{client_id}] Finished: {res}")
self.join_queue.append(plugin.process)
logging.debug(f"[PluginScheduler:{client_id}] Process joined")
plugin_list.remove(plugin)
Expand Down
10 changes: 2 additions & 8 deletions conveyor/scheduling/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from conveyor.models.config import ModelConfig

from conveyor.scheduling.cache_manager import CacheManager
from conveyor.scheduling.parsing import BaseParser, FunctionaryParser
from conveyor.scheduling.parsing import BaseParser
from conveyor.utils import getLogger

logging = getLogger(__name__)
Expand Down Expand Up @@ -102,9 +102,6 @@ def new(
config.head_dim,
1,
)
# logging.debug(
# f"InferenceContext::new(): state={state}, req_ids={req_ids}, seq_lens={seq_lens}, filling_start_offset={filling_start_offset}, kv_indptr={kv_indptr}, kv_page_index={kv_page_index}, kv_last_page_lens={kv_last_page_lens}, qo_indptr={qo_indptr}"
# )

return cls(
state=state,
Expand Down Expand Up @@ -147,10 +144,7 @@ def __init__(self, req_id: int, input_text: str, tokenizer, parser: BaseParser):
self.parser = parser

def evaluate_parser(self, token: int):
tokens = self.parser.enqueue(token)
# if tokens is not None:
# print(f"::: Evaluate Raw: !!@ {tokens} @!!")
# print(f"::: Evaluate Decoded: !!@ {self.tokenizer.decode(tokens)} @!!")
self.parser.enqueue(token)

def decode(self) -> str:
return self.tokenizer.decode(self.tokens)
Expand Down
3 changes: 0 additions & 3 deletions conveyor/scheduling/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def enqueue(self, token) -> Optional[Dict | List]:
self.in_progress = False
self.buffer = []
self.string = ""
# print(f"The string is: ::>{self.string}<::")
return buf
case _:
new_str: str = self.tokenizer.convert_ids_to_tokens(token)
Expand Down Expand Up @@ -99,7 +98,6 @@ def enqueue(self, token) -> Optional[Dict | List]:
self.in_progress = False
self.buffer = []
self.string = ""
# print(f"The string is: ::>{self.string}<::")
return buf
case _:
new_str: str = self.tokenizer.convert_ids_to_tokens(token)
Expand All @@ -121,7 +119,6 @@ class FunctionaryParser(BaseParser):
def __init__(self, tokenizer, client_id, start_cb, update_cb, finish_cb):
self.buffer = []
self.string = ""
# self.left_bracket_pos = []
self.tokenizer = tokenizer
self.start_cb = start_cb
self.update_cb = update_cb
Expand Down
7 changes: 0 additions & 7 deletions conveyor/scheduling/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def iteration_step(
self.roundrobin_policy()
# self.fcfs_policy()
next_operation = self.schedule_next_operation()
# logging.debug(f"Scheduler: next operation={next_operation}")
match next_operation:
case InferenceState.APPEND:
logits, _ = self.forward_append(self.context)
Expand Down Expand Up @@ -321,7 +320,6 @@ def prepare_kv_page(
page_needed, page_idx_start = compute_page_needed(
sched_ctx.seq_lens, sched_ctx.completed_lens, cache_manager.page_size
)
# logging.debug(f"page_needed={page_needed}, page_idx_start={page_idx_start}")

page_num_required = int(page_needed.sum().item())
if page_num_required > 0:
Expand All @@ -332,9 +330,6 @@ def prepare_kv_page(
(page_needed.size(0) + 1,), dtype=torch.int64, device="cpu"
)
range_idx[1:] = page_needed.cumsum(dim=0)
# logging.debug(
# f"Allocated pages: new_page_idx={new_page_idx}, range_idx={range_idx}"
# )
for i in range(page_needed.size(0)):
cache_manager.req_page_mapping[
req_ids[i],
Expand Down Expand Up @@ -391,7 +386,6 @@ def forward_decode(self, sched_ctx: SchedulerContext) -> None:
req_ids = torch.tensor(
[req.req_id for req in sched_ctx.requests], dtype=torch.int64, device="cuda"
)
# sched_ctx.seq_lens.add_(1)

ScheduleEngine.prepare_kv_page(req_ids, sched_ctx, self.cache_manager)

Expand Down Expand Up @@ -468,7 +462,6 @@ def schedule_next_operation(self) -> InferenceState:

def fcfs_policy(self) -> None:
while self.new_request_available():
# TODO: more than one request can be added
new_request = self.request_pool.pop_request()
logging.info(f"Scheduler: new request={new_request.req_id}")
self.context.add_active_request(new_request)
Expand Down

0 comments on commit 1c8a67c

Please sign in to comment.