Qwen2-0.5b LoRA Fine-tuned on OpenCodeInstruct

This model is a LoRA fine-tuned version of Qwen/Qwen2-0.5B-Instruct on the OpenCodeInstruct dataset.

Model Details

  • Base Model: Qwen/Qwen2-0.5B-Instruct
  • Fine-tuning Dataset: OpenCodeInstruct (300 samples)
  • Fine-tuning Method: LoRA (Low-Rank Adaptation)
  • LoRA Rank: 16
  • LoRA Alpha: 32

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# Load base model
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B-Instruct")

# Load LoRA adapters
model = PeftModel.from_pretrained(base_model, "alpayH/qwen2-0.5b-lora-opencodeinstruct")

# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("alpayH/qwen2-0.5b-lora-opencodeinstruct")

# Generate code
prompt = "### Instruction:\nWrite a Python function to reverse a string\n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=512)
print(tokenizer.decode(outputs[0]))

Training Details

  • Learning Rate: 2e-4
  • Batch Size: 16 (effective, with gradient accumulation)
  • Epochs: 3
  • Precision: bfloat16

Evaluation

This model has been evaluated on LiveCodeBench. See the main repository for evaluation results.

License

Apache 2.0

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for alpayH/qwen2-0.5b-lora-opencodeinstruct

Base model

Qwen/Qwen2-0.5B
Adapter
(501)
this model