Views
No views yet
Question: [your medical question here]
Please reason step by step, and put the final answer in \boxed{}
1from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
2
3# Load model and tokenizer
4model_id = "che111/AlphaMed-3B-instruct-rl" # Replace with actual repo path
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id)
7
8pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
9
10# Format question
11prompt = (
12 "Question: A 45-year-old patient presents with chest pain radiating to the left arm and elevated troponin levels. "
13 "What is the most likely diagnosis?\n"
14 "Please reason step by step, and put the final answer in \\boxed{}"
15)
16
17# Generate output
18max_new_tokens=8196
19output = pipe(prompt, max_new_tokens=max_new_tokens, do_sample=False)[0]["generated_text"]
20print(output)