Downloads · 30 days
10
15% of all-time downloads
sriram279/Leet-Reason-Qwen0.5
Leet-Reason-Qwen0.5 is a text generation model from sriram279. Use it when you need the model to write or continue text. It is set up for transformers.
This model is a merged, fine-tuned version of AdithyaSK/Qwen-0.5b-Code-Reasoning-v1 on the greengerong/leetcode dataset. It is optimized to generate clean, correct Python code solutions and corresponding explanations…
Downloads · 30 days
10
15% of all-time downloads
All-time downloads
67
Public
Parameters
494M
1000 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors988 MB · 99%
From the Hugging Face model README
This model is a merged, fine-tuned version of AdithyaSK/Qwen-0.5b-Code-Reasoning-v1 on the greengerong/leetcode dataset. It is optimized to generate clean, correct Python code solutions and corresponding explanations for algorithmic programming problems.
The model was fine-tuned using Hugging Face's TRL SFTTrainer and PEFT (LoRA) on Windows. The following hyperparameters were used:
gate_proj, down_proj, k_proj, q_proj, v_proj, up_proj, o_projadamw_8bit)The training pipeline extracted the problem description (content) and mapped it to the Python solution (python) under the Alpaca instruction format:
### Instruction:
[LeetCode Problem Description]
### Response:
[Python Code Solution and Explanation]
You can load and query this model directly using Hugging Face Transformers:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load the merged model
model_id = "sriram279/Leet-Reason-Qwen0.5"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# Format your prompt
prompt = "solve Two sum problem in Python"
inputs = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
# Generate
outputs = model.generate(
inputs,
max_new_tokens=512,
temperature=0.7,
do_sample=True
)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))