Skip to content

Commit

Permalink
Ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
CollectiveUnicorn committed May 10, 2024
1 parent 4ce550d commit d0c707d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/llama-cpp-python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def generate(
yield res["choices"][0]["text"] # type: ignore

async def count_tokens(self, raw_text: str):
string_bytes: bytes = bytes(raw_text, 'utf-8')
string_bytes: bytes = bytes(raw_text, "utf-8")
tokens: list[int] = self.llm.tokenize(string_bytes)
return len(tokens)
5 changes: 4 additions & 1 deletion packages/vllm/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,12 @@ async def ChatCompleteStream(
logging.info("ChatCompleteStream END:\n---")

async def count_tokens(self, raw_text: str):
tokens: list[int] | list[str] = (await self.engine.get_tokenizer()).tokenize(raw_text)
tokens: list[int] | list[str] = (await self.engine.get_tokenizer()).tokenize(
raw_text
)
return len(tokens)


async def main():
logging.basicConfig(level=logging.INFO)
await serve(Model())
Expand Down

0 comments on commit d0c707d

Please sign in to comment.