Skip to content

Commit

Permalink
comma and other text issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
risingsunomi committed Oct 7, 2024
1 parent 913a008 commit b518f73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 1 addition & 8 deletions exo/api/chatgpt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,9 @@ def generate_completion(
}

choice = completion["choices"][0]
print(f"\nchoice {choice}")
if object_type.startswith("chat.completion"):
key_name = "delta" if stream else "message"

token_decode = tokenizer.batch_decode(
tokens,
skip_special_tokens=True,
clean_up_tokenization_spaces=False
)
choice[key_name] = {"role": "assistant", "content": token_decode}
choice[key_name] = {"role": "assistant", "content": tokenizer.decode(tokens)}
elif object_type == "text_completion":
choice["text"] = tokenizer.decode(tokens)
else:
Expand Down
1 change: 1 addition & 0 deletions exo/inference/pytorch/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from exo.download.hf.hf_shard_download import HFShardDownloader

from transformers import AutoTokenizer

# llama
from transformers.models.llama.modeling_llama import LlamaModel

Expand Down

0 comments on commit b518f73

Please sign in to comment.