Downloads · 30 days
24
48% of all-time downloads
VesileHan/Qwen2.5_Coder_0.5B_CPP
Qwen2.5_Coder_0.5B_CPP is a machine learning model from VesileHan. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This is a fine-tuned version of the highly capable Qwen2.5-Coder-0.5B model. It has been specifically instruction-tuned to answer programming questions and write code for the C++ programming language. - Base Model: Qw…
Downloads · 30 days
24
48% of all-time downloads
All-time downloads
50
Public
Parameters
494M
2 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors2 GB · 99%
From the Hugging Face model README
This is a fine-tuned version of the highly capable Qwen2.5-Coder-0.5B model. It has been specifically instruction-tuned to answer programming questions and write code for the C++ programming language.
This model was fine-tuned using a filtered subset of the sahil2801/CodeAlpaca-20k dataset. The training data was specifically filtered to only include instructions and inputs that reference C++ or cpp, ensuring the model focuses heavily on this language domain.
The model was fine-tuned using the Hugging Face trl library (SFTTrainer) with the following hyperparameters:
Optimizer: AdamW Learning Rate: 2e-5 Batch Size: 1 (with gradient accumulation of 4) Precision: fp16 (Mixed Precision)
You can load and use this model directly with the transformers library:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "VesileHan/Qwen2.5_coder_cpp"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.float16
)
question = "How do I reverse a string in C++?"
prompt = f"Below is an instruction that describes a coding task. Write a response that appropriately completes the request.\n\n### Instruction:\n{question}\n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7)
print(tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True))