Views
No views yet
200064 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.<|system|>Insert System Message<|end|><|user|>Insert User Message<|end|><|assistant|><|system|>You are a helpful assistant with some tools.<|tool|>[{"name": "get_weather_updates", "description": "Fetches weather updates for a given city using the RapidAPI Weather API.", "parameters": {"city": {"description": "The name of the city for which to retrieve weather information.", "type": "str", "default": "London"}}}]<|/tool|><|end|><|user|>What is the weather like in Paris today?<|end|><|assistant|>flash_attn==2.7.4.post1
torch==2.6.0
vllm>=0.7.21from vllm import LLM, SamplingParams
2
3llm = LLM(model="microsoft/Phi-4-mini-instruct", trust_remote_code=True)
4
5messages = [
6 {"role": "system", "content": "You are a helpful AI assistant."},
7 {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
8 {"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."},
9 {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
10]
11
12sampling_params = SamplingParams(
13 max_tokens=500,
14 temperature=0.0,
15)
16
17output = llm.chat(messages=messages, sampling_params=sampling_params)
18print(output[0].outputs[0].text)4.49.0 version of transformers. The current transformers version can be verified with: pip list | grep transformers.flash_attn==2.7.4.post1
torch==2.6.0
transformers==4.49.0
accelerate==1.3.01import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
4torch.random.manual_seed(0)
5
6model_path = "microsoft/Phi-4-mini-instruct"
7
8model = AutoModelForCausalLM.from_pretrained(
9 model_path,
10 device_map="auto",
11 torch_dtype="auto",
12 trust_remote_code=True,
13)
14tokenizer = AutoTokenizer.from_pretrained(model_path)
15
16messages = [
17 {"role": "system", "content": "You are a helpful AI assistant."},
18 {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
19 {"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."},
20 {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
21]
22
23pipe = pipeline(
24 "text-generation",
25 model=model,
26 tokenizer=tokenizer,
27)
28
29generation_args = {
30 "max_new_tokens": 500,
31 "return_full_text": False,
32 "temperature": 0.0,
33 "do_sample": False,
34}
35
36output = pipe(messages, **generation_args)
37print(output[0]['generated_text'])