From dade7677cffdec05bccd740898ccbe46cf34da15 Mon Sep 17 00:00:00 2001 From: chenyu Date: Mon, 24 Jun 2024 20:58:25 -0400 Subject: [PATCH] validate llama3 output only with model "LLaMA-3/8B-SF-DPO" (#5138) --- examples/llama3.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/llama3.py b/examples/llama3.py index fb79dd9a65..27a65d213c 100644 --- a/examples/llama3.py +++ b/examples/llama3.py @@ -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.")