Views
No views yet
Qwen/Qwen2.5-0.5B causal language model on the allenai/openbookqa dataset. It has been specifically trained to perform multiple-choice question answering for elementary-level science facts and reasoning.Qwen/Qwen2.5-0.5BAnswer: and the model predicts a single token (A, B, C, or D) corresponding to the correct choice.1Question: {question_stem}
2A. {choice_1}
3B. {choice_2}
4C. {choice_3}
5D. {choice_4}
6Answer: 1Question: The sun is responsible for
2A. puppies learning new tricks
3B. children growing up and getting old
4C. flowers wilting in a vase
5D. plants sprouting, blooming and wilting
6Answer: bfloat16transformers:1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "imuki04/Qwen2.5-0.5B-OpenBookQA-Finetuned" # Replace your repo name if needed
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12
13prompt = "Question: The sun is responsible for\nA. puppies learning new tricks\nB. children growing up and getting old\nC. flowers wilting in a vase\nD. plants sprouting, blooming and wilting\nAnswer:"
14inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
15
16with torch.no_grad():
17 outputs = model.generate(**inputs, max_new_tokens=5, temperature=0.0)
18
19print(tokenizer.decode(outputs[0], skip_special_tokens=True))