Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing parameters in model_chat.py #3233

Merged
merged 1 commit into from
May 26, 2023
Merged

Conversation

Choiuijin1125
Copy link
Contributor

In model/model_training/tools/model_chat.py, process_output function supposed to have a method and bot_name parameters

Function call line

reply = process_output(output, method, bot_name)

Definition

def process_output(output):
if method == "v2":
answer = output.split(QA_SPECIAL_TOKENS["Answer"])[-1]
answer = answer.split("</s>")[0].replace("<|endoftext|>", "").lstrip().split(QA_SPECIAL_TOKENS["Answer"])[0]
elif method == "v2.5":
answer = output.split(f"{ChatRole.assistant}")[-1]
# answer = answer.split("</s>")[0].replace(SeqToken.end, "").lstrip()
# elif method == "v3":
# answer = output.split(f"{SeqToken.begin}{ChatRole.assistant}{SeqToken.delimiter}")[-1]
# answer = answer.split("</s>")[0].replace(SeqToken.end, "").lstrip()
else:
answer = output.split("\n\n{}:".format(bot_name))[-1]
answer = answer.split("</s>")[0].replace("<|endoftext|>", "").lstrip().split("\n\n{}:".format(bot_name))[0]
return answer

Copy link
Collaborator

@sanagno sanagno left a comment

Choose a reason for hiding this comment

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

Thanks!

@sanagno sanagno merged commit 812d1b8 into LAION-AI:main May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants