Skip to content

Commit b518f73

Browse files
committed
comma and other text issue fix
1 parent 913a008 commit b518f73

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

exo/api/chatgpt_api.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,9 @@ def generate_completion(
7171
}
7272

7373
choice = completion["choices"][0]
74-
print(f"\nchoice {choice}")
7574
if object_type.startswith("chat.completion"):
7675
key_name = "delta" if stream else "message"
77-
78-
token_decode = tokenizer.batch_decode(
79-
tokens,
80-
skip_special_tokens=True,
81-
clean_up_tokenization_spaces=False
82-
)
83-
choice[key_name] = {"role": "assistant", "content": token_decode}
76+
choice[key_name] = {"role": "assistant", "content": tokenizer.decode(tokens)}
8477
elif object_type == "text_completion":
8578
choice["text"] = tokenizer.decode(tokens)
8679
else:

exo/inference/pytorch/inference.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from exo.download.hf.hf_shard_download import HFShardDownloader
1515

1616
from transformers import AutoTokenizer
17+
1718
# llama
1819
from transformers.models.llama.modeling_llama import LlamaModel
1920

0 commit comments

Comments
 (0)