Views
No views yet
4.41.2 version of transformers. The current transformers version can be verified with: pip list | grep transformers.flash_attn==2.5.8
torch==2.3.1
accelerate==0.31.0
transformers==4.41.232064 tokens. The tokenizer files already provide placeholder tokens that can be used for downstream fine-tuning, but they can also be extended up to the model's vocabulary size.1<|system|>
2You are a helpful assistant.<|end|>
3<|user|>
4Question?<|end|>
5<|assistant|>1<|system|>
2You are a helpful assistant.<|end|>
3<|user|>
4How to explain Internet for a medieval knight?<|end|>
5<|assistant|> <|assistant|> . In case of few-shots prompt, the prompt can be formatted as the following:1<|system|>
2You are a helpful travel assistant.<|end|>
3<|user|>
4I am going to Paris, what should I see?<|end|>
5<|assistant|>
6Paris, 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:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. 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.\n3. 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.\n\nThese 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."<|end|>
7<|user|>
8What is so great about #1?<|end|>
9<|assistant|>1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
4torch.random.manual_seed(0)
5model = AutoModelForCausalLM.from_pretrained(
6 "microsoft/Phi-3-mini-4k-instruct",
7 device_map="cuda",
8 torch_dtype="auto",
9 trust_remote_code=True,
10)
11
12tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
13
14messages = [
15 {"role": "system", "content": "You are a helpful AI assistant."},
16 {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
17 {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
18 {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
19]
20
21pipe = pipeline(
22 "text-generation",
23 model=model,
24 tokenizer=tokenizer,
25)
26
27generation_args = {
28 "max_new_tokens": 500,
29 "return_full_text": False,
30 "temperature": 0.0,
31 "do_sample": False,
32}
33
34output = pipe(messages, **generation_args)
35print(output[0]['generated_text'])