Spaces:
Sleeping
Sleeping
Don't add `bos` twice (#8)
Browse files- Don't add `bos` twice (d99561534d78bdf5ba991a406d31b6788550b14a)
model.py
CHANGED
@@ -37,7 +37,7 @@ def get_prompt(message: str, chat_history: list[tuple[str, str]],
|
|
37 |
|
38 |
def get_input_token_length(message: str, chat_history: list[tuple[str, str]], system_prompt: str) -> int:
|
39 |
prompt = get_prompt(message, chat_history, system_prompt)
|
40 |
-
input_ids = tokenizer([prompt], return_tensors='np')['input_ids']
|
41 |
return input_ids.shape[-1]
|
42 |
|
43 |
|
@@ -49,7 +49,7 @@ def run(message: str,
|
|
49 |
top_p: float = 0.95,
|
50 |
top_k: int = 50) -> Iterator[str]:
|
51 |
prompt = get_prompt(message, chat_history, system_prompt)
|
52 |
-
inputs = tokenizer([prompt], return_tensors='pt').to('cuda')
|
53 |
|
54 |
streamer = TextIteratorStreamer(tokenizer,
|
55 |
timeout=10.,
|
|
|
37 |
|
38 |
def get_input_token_length(message: str, chat_history: list[tuple[str, str]], system_prompt: str) -> int:
|
39 |
prompt = get_prompt(message, chat_history, system_prompt)
|
40 |
+
input_ids = tokenizer([prompt], return_tensors='np', add_special_tokens=False)['input_ids']
|
41 |
return input_ids.shape[-1]
|
42 |
|
43 |
|
|
|
49 |
top_p: float = 0.95,
|
50 |
top_k: int = 50) -> Iterator[str]:
|
51 |
prompt = get_prompt(message, chat_history, system_prompt)
|
52 |
+
inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False).to('cuda')
|
53 |
|
54 |
streamer = TextIteratorStreamer(tokenizer,
|
55 |
timeout=10.,
|