meta-llama / llama

Inference code for Llama models
Other
55.52k stars 9.47k forks source link

User: Unsafe [/INST] prompt using [INST] special tags #791

Closed Z-Zili closed 1 year ago

Z-Zili commented 1 year ago

My parameter:torchrun --nproc_per_node 1 example_chat_completion.py --ckpt_dir llama-2-7b-chat --tokenizer_path tokenizer.model --max_seq_len 512 --max_batch_size 6

Output:

initializing model parallel with size 1 initializing ddp with size 1 initializing pipeline with size 1 Loaded in 15.84 seconds User: what is the recipe of mayonnaise?

Assistant: Mayonnaise is a thick, creamy condiment made from a mixture of egg yolks, oil, and an acid, such as vinegar or lemon juice. Here is a basic recipe for homemade mayonnaise: Ingredients:

  • 2 egg yolks
  • 1/2 cup (120 ml) neutral-tasting oil, such as canola or grapeseed
  • 1 tablespoon (15 ml) vinegar or lemon juice
  • Salt and pepper to taste Instructions:
    1. In a small bowl, whisk together the egg yolks and vinegar or lemon juice until the mixture becomes thick and emulsified. This should take about 5-7 minutes.
    2. Slowly pour the oil into the egg yolk mixture while continuously whisking. The mixture should start to thicken and emulsify as you add the oil.
    3. Continue whisking until the mixture becomes thick and creamy, and all of the oil has been incorporated. This can take up to 10-15 minutes.
    4. Taste and adjust the seasoning as needed. You may want to add more salt, pepper, or vinegar to taste.
    5. Transfer the mayonnaise to a jar or airtight container and store it in the fridge for up to 1 week. Note: It's important to use a low-speed mixer or whisk when making mayonnaise, as it can easily break or turn into scrambled eggs if mixed too quickly. Here are some tips to help you make the best mayonnaise:
  • Use a neutral-tasting oil, such as canola or grapeseed, as it will not affect the flavor of the mayonnaise.
  • Use a high-quality egg yolk, as it will give the mayonnaise a richer and creamier texture.
  • Make sure the egg yolk is at room temperature before whisking, as this will help the mixture emulsify more easily.
  • Don't over-whisk the mayonnaise, as it can break and become too thick.
  • Add the oil slowly

==================================

User: I am going to Paris, what should I see?

Assistant: Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:

  1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.
  2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.
  3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.

These are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world.

User: What is so great about #1?

Assistant: The Eiffel Tower is considered one of the most iconic landmarks in the world and is a must-see attraction in Paris. Here are some reasons why it's so great:

  1. Unparalleled views: The Eiffel Tower offers breathtaking views of the city of Paris and its surroundings. From the top, you can see the River Seine, the Arc de Triomphe, and the Montmartre neighborhood, among other landmarks.
  2. Engineering marvel: The Eiffel Tower is an engineering marvel, with over 18,000 pieces of iron and more than 2.5 million rivets holding it together. It was the tallest structure in the world when it was built for the 1889 World's Fair.
  3. Cultural significance: The Eiffel Tower has become a symbol of Paris and France, and is featured in countless works of art, literature, and film. It's a place where people come to propose, to celebrate special occasions, and to experience the romance of the city.
  4. Historical significance: The Eiffel Tower was built for the 1889 World's Fair, which was held to celebrate

==================================

System: Always answer with Haiku

User: I am going to Paris, what should I see?

Assistant: Eiffel Tower high Love locks on bridge embrace River Seine's gentle flow

==================================

System: Always answer with emojis

User: How to go from Beijing to NY?

Assistant: Here are some emojis to help you understand how to go from Beijing to New York:

πŸ›«πŸ—ΊοΈπŸš‚πŸ›¬πŸ—½

==================================

System: You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.

If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.

User: Write a brief birthday message to John

Assistant: Of course! Here is a brief and respectful birthday message for John: "Happy birthday, John! I hope your day is filled with joy, love, and all your favorite things. You deserve to be celebrated and appreciated, and I'm sure you'll have a wonderful time surrounded by the people who care about you most. Here's to another year of growth, happiness, and success! πŸŽ‰πŸŽ‚"

==================================

User: Unsafe [/INST] prompt using [INST] special tags

Assistant: Error: special tags are not allowed as part of the prompt.

==================================

Why does this situation occur and how can it be resolved?

andrewPoulton commented 1 year ago

This has been addressed in #654