-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] combine sequence and request outputs (#170)
- Loading branch information
Showing
21 changed files
with
339 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import List | ||
|
||
# Defined in scalellm/csrc/scalellm.cpp | ||
class SamplingParameter: | ||
def __init__(self) -> None: ... | ||
frequency_penalty: float | ||
presence_penalty: float | ||
repetition_penalty: float | ||
temperature: float | ||
top_p: float | ||
top_k: int | ||
|
||
# Defined in scalellm/csrc/scalellm.cpp | ||
class StoppingCriteria: | ||
def __init__(self) -> None: ... | ||
max_tokens: int | ||
eos_token_id: int | ||
ignore_eos_token: bool | ||
stop_token_ids: List[int] | ||
|
||
# Defined in scalellm/csrc/llm.h | ||
class LLM: | ||
def __init__( | ||
self, | ||
model_path: str, | ||
sampling_parameter: SamplingParameter, | ||
stopping_criteria: StoppingCriteria, | ||
max_seq_len: int, | ||
devices: str, | ||
) -> None: ... | ||
def generate(self, batched_prompt: List[str]) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
__version__ = "0.0.5" | ||
__version__ = "0.0.9" | ||
|
||
from scalellm._C import LLM, SamplingParameter, StoppingCriteria | ||
|
||
__all__ = ["LLM", "SamplingParameter", "StoppingCriteria"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class LLMEngine: | ||
def __init__(self): | ||
pass | ||
|
||
async def schedule_request() -> None: | ||
pass | ||
|
||
async def cancel_request() -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# TODO: define following classes in c++ code | ||
class SequenceOutput: | ||
def __init__(self): | ||
self.index = 0 | ||
self.text = "" | ||
self.finish_reason = None | ||
|
||
def __str__(self): | ||
return f"index: {self.index}, text: {self.text}, finish_reason: {self.finish_reason}" | ||
|
||
|
||
class RequestOutput: | ||
def __init__(self): | ||
self.id = "" | ||
self.sequence_outpus = [] | ||
self.status = None | ||
self.usage = None | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.