Phi-4 चे एक मुख्य वैशिष्ट्य म्हणजे त्याची मजबूत तर्कशक्ती. Phi-4-mini च्या माध्यमातून त्याच्या या शक्तिशाली तर्कशक्तीवर एक नजर टाकूया.
import torch
from transformers import AutoTokenizer,pipeline
model_path = "Your Phi-4-mini location"
model = AutoModelForCausalLM.from_pretrained(
model_path,
device_map="cuda",
attn_implementation="flash_attention_2",
torch_dtype="auto",
trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
messages = [
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": """I have $20,000 in my savings account, where I receive a 4% profit per year and payments twice a year. Can you please tell me how long it will take for me to become a millionaire? Thinks step by step carefully.
"""},
]
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
)
generation_args = {
"max_new_tokens": 4096,
"return_full_text": False,
"temperature": 0.00001,
"top_p": 1.0,
"do_sample": True,
}
output = pipe(messages, **generation_args)
print(output[0]['generated_text'])
अस्वीकरण:
हा दस्तऐवज मशीन-आधारित एआय अनुवाद सेवा वापरून अनुवादित करण्यात आला आहे. आम्ही अचूकतेसाठी प्रयत्नशील असलो तरी, कृपया लक्षात घ्या की स्वयंचलित अनुवादांमध्ये त्रुटी किंवा अचूकतेचा अभाव असू शकतो. मूळ भाषेतील मूळ दस्तऐवज हा अधिकृत स्रोत मानला पाहिजे. महत्त्वाच्या माहितीसाठी व्यावसायिक मानव अनुवादाची शिफारस केली जाते. या अनुवादाचा वापर करून उद्भवणाऱ्या कोणत्याही गैरसमज किंवा चुकीच्या अर्थासाठी आम्ही जबाबदार राहणार नाही.