Skip to content

Commit

Permalink
fix user_role
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyuyang committed Oct 9, 2023
1 parent 1e7a319 commit ccd0ed6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/fastllm_pytools/torch2flm.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def tofile(exportPath,
# Baichuan 2代
modelInfo["use_alibi"] = "1"
modelInfo["pre_prompt"] = ""
modelInfo["user_role"] = ("<FLM_FIX_TOKEN_" + str(model.generation_config.user_token_id) + "> ") if hasattr(model.generation_config, "user_token_id") else "";
modelInfo["user_role"] = ("<FLM_FIX_TOKEN_" + str(model.generation_config.user_token_id) + ">") if hasattr(model.generation_config, "user_token_id") else "";
modelInfo["bot_role"] = ("<FLM_FIX_TOKEN_" + str(model.generation_config.assistant_token_id) + ">") if hasattr(model.generation_config, "assistant_token_id") else "";
modelInfo["history_sep"] = ""
if modelInfo["model_type"] == "qwen":
Expand Down

1 comment on commit ccd0ed6

@TylunasLi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据我测试,baichuan1确实需要这个空格,而baichuan2不需要这个空格。这样tokenizer才能对齐。
https://github.com/TylunasLi/fastllm/blob/llama/docs/llama_cookbook.md

Please sign in to comment.