Skip to content

Commit

Permalink
Merge pull request exo-explore#19 from risingsunomi/pr139-dev-oct24
Browse files Browse the repository at this point in the history
comma and other text issue fix
  • Loading branch information
risingsunomi authored Oct 7, 2024
2 parents 216e83d + b518f73 commit 296dff6
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 296dff6

Please sign in to comment.