Downloads · 30 days
38
13% of all-time downloads
yixuantt/Qwen2.5-3B-R1-Finance
Qwen2.5-3B-R1-Finance is a text generation model from yixuantt. Use it when you need the model to write or continue text. The card lists the license as cc-by-nc-4.0.
This is a toy model using CoT-sft with GRPO.
Downloads · 30 days
38
13% of all-time downloads
All-time downloads
299
Public
Parameters
3.4B
6.8 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors6.8 GB · 100%
From the Hugging Face model README
This is a toy model using CoT-sft with GRPO.
tokenizer = AutoTokenizer.from_pretrained("yixuantt/Qwen2.5-3B-R1-Finance")
model = AutoModelForCausalLM.from_pretrained("yixuantt/Qwen2.5-3B-R1-Finance",
torch_dtype = torch.bfloat16,
device_map = "auto"
)
model.eval()
print(model)
def generate(text):
conv = [{"role": "system",
"content": "You are a helpful AI Assistant that provides well-reasoned and detailed responses. You first think about the reasoning process as an internal monologue and then provide the user with the answer."},{"role": "user", "content": text}]
prompt = tokenizer.apply_chat_template(conversation=conv, tokenize=False, add_generation_prompt=True)
encoded = tokenizer(prompt, return_tensors="pt")
generate_params = dict(
max_new_tokens=1024,
do_sample=True,
top_k=20,
)
with torch.no_grad():
generation_output = model.generate(input_ids=encoded.input_ids.cuda(),
attention_mask=encoded.attention_mask.cuda(),
tokenizer=tokenizer,
**generate_params)
generation_output = generation_output[:, encoded.input_ids.shape[1]:]
out = tokenizer.decode(generation_output[0], skip_special_tokens=True)
# print(out)
return out