add support for python3.8 3.9

This commit is contained in:
josc146 2023-06-12 12:09:23 +08:00
parent face4c97e8
commit fa0fcc2c89
3 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from typing import Any, Dict
from typing import Any, Dict, List
from utils.log import quick_log
from fastapi import APIRouter, HTTPException, Request, Response, status
from pydantic import BaseModel
@ -31,7 +31,7 @@ def init():
class AddStateBody(BaseModel):
prompt: str
tokens: list[str]
tokens: List[str]
state: Any
logits: Any

View File

@ -72,9 +72,9 @@ class TRIE_TOKENIZER:
for t, i in self.token2idx.items():
_ = self.root.add(t, val=(t, i))
def encodeBytes(self, src: bytes) -> list[int]:
def encodeBytes(self, src: bytes):
idx: int = 0
tokens: list[int] = []
tokens = []
while idx < len(src):
_idx: int = idx
idx, _, values = self.root.find_longest(src, idx)