Skip to content

Commit

Permalink
Update conversation.py add aquila-legacy
Browse files Browse the repository at this point in the history
Signed-off-by: ldwang <[email protected]>
  • Loading branch information
ldwang committed Oct 9, 2023
1 parent f828c01 commit 4011bd0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions flagai/model/aquila2/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,21 @@ def get_conversation_template(model_path: str) -> Conversation:
)
)

register_conv_template(
Conversation(
name="aquila-legacy",
system_message="A chat between a curious human and an artificial intelligence assistant. "
"The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
roles=("### Human: ", "### Assistant: ", "System"),
messages=(),
offset=0,
sep_style=SeparatorStyle.NO_COLON_TWO,
sep="\n",
sep2="",
stop_str=["</s>", "[UNK]"],
)
)

if __name__ == "__main__":
print("aquila template:")
conv = get_conv_template("aquila")
Expand Down Expand Up @@ -240,3 +255,14 @@ def get_conversation_template(model_path: str) -> Conversation:
print(conv.get_prompt())

print("\n")

print("aquila-legacy template:")
conv = get_conv_template("aquila-legacy")
conv.append_message(conv.roles[0], "Hello!")
conv.append_message(conv.roles[1], "Hi!")
conv.append_message(conv.roles[0], "How are you?")
conv.append_message(conv.roles[1], None)
print(conv.get_prompt())

print("\n")

0 comments on commit 4011bd0

Please sign in to comment.