validate llama3 output only with model "LLaMA-3/8B-SF-DPO" (#5138)

This commit is contained in:
chenyu
2024-06-24 20:58:25 -04:00
committed by GitHub
parent 981afb114f
commit dade7677cf

View File

@@ -402,16 +402,17 @@ if __name__ == "__main__":
last_tok = tok
generated += tokenizer.decode([tok])
print(generated)
EXPECTED_TEXT = {
1: "Hello! How can I help you today? If you have any questions or need assistance with anything,",
2: "Hello! How can I help you today? If you have any questions, need assistance or just want",
3: "Hello! How can I help you today? If you have any questions or need assistance, feel free",
4: "Hello! How can I assist you today? If you have any questions, need information, or require",
5: "Hello! How can I assist you today? If you have any questions or need help with something",
6: "Hello! How can I assist you today? If you have any questions, need information, or require",
}
assert generated == EXPECTED_TEXT[args.shard], f"{generated=} {EXPECTED_TEXT[args.shard]}"
print("\n" + colored("output validated", "green")) # NOTE: "\n" inside colored does not render the color in github action
if "LLaMA-3/8B-SF-DPO" in args.model.as_posix():
EXPECTED_TEXT = {
1: "Hello! How can I help you today? If you have any questions or need assistance with anything,",
2: "Hello! How can I help you today? If you have any questions, need assistance or just want",
3: "Hello! How can I help you today? If you have any questions or need assistance, feel free",
4: "Hello! How can I assist you today? If you have any questions, need information, or require",
5: "Hello! How can I assist you today? If you have any questions or need help with something",
6: "Hello! How can I assist you today? If you have any questions, need information, or require",
}
assert generated == EXPECTED_TEXT[args.shard], f"{generated=} {EXPECTED_TEXT[args.shard]}"
print("\n" + colored("output validated", "green")) # NOTE: "\n" inside colored does not render the color in github action
else:
prompt = [tokenizer.bos_id] + encode_message("system", "You are an helpful assistant.")