add support for python3.8 3.9
This commit is contained in:
parent
face4c97e8
commit
fa0fcc2c89
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict
|
from typing import Any, Dict, List
|
||||||
from utils.log import quick_log
|
from utils.log import quick_log
|
||||||
from fastapi import APIRouter, HTTPException, Request, Response, status
|
from fastapi import APIRouter, HTTPException, Request, Response, status
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
@ -31,7 +31,7 @@ def init():
|
|||||||
|
|
||||||
class AddStateBody(BaseModel):
|
class AddStateBody(BaseModel):
|
||||||
prompt: str
|
prompt: str
|
||||||
tokens: list[str]
|
tokens: List[str]
|
||||||
state: Any
|
state: Any
|
||||||
logits: Any
|
logits: Any
|
||||||
|
|
||||||
|
4
backend-python/rwkv_pip/rwkv_tokenizer.py
vendored
4
backend-python/rwkv_pip/rwkv_tokenizer.py
vendored
@ -72,9 +72,9 @@ class TRIE_TOKENIZER:
|
|||||||
for t, i in self.token2idx.items():
|
for t, i in self.token2idx.items():
|
||||||
_ = self.root.add(t, val=(t, i))
|
_ = self.root.add(t, val=(t, i))
|
||||||
|
|
||||||
def encodeBytes(self, src: bytes) -> list[int]:
|
def encodeBytes(self, src: bytes):
|
||||||
idx: int = 0
|
idx: int = 0
|
||||||
tokens: list[int] = []
|
tokens = []
|
||||||
while idx < len(src):
|
while idx < len(src):
|
||||||
_idx: int = idx
|
_idx: int = idx
|
||||||
idx, _, values = self.root.find_longest(src, idx)
|
idx, _, values = self.root.find_longest(src, idx)
|
||||||
|
Loading…
Reference in New Issue
Block a user