CoolFace
Modelpublic

kiranpg/Qwen2.5-OCamler-1.5B-Instruct-v2

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
0likes18downloads
Model Card

Qwen2.5-OCamler-1.5B-Instruct-v2

This model is a fine-tuned version of Qwen/Qwen2.5-Coder-1.5B-Instruct specialized for generating OCaml code.

Model Details

  • —Base Model: Qwen/Qwen2.5-Coder-1.5B-Instruct
  • —Fine-tuning Method: Group Relative Policy Optimization (GRPO) with LoRA
  • —Training Dataset: kiranpg/ocaml-training-problems

Training Configuration

GRPO Parameters

ParameterValue
Batch Size4
Gradient Accumulation Steps1
Effective Batch Size4
Learning Rate1e-6
Number of Epochs3
Max Prompt Length800
Max Completion Length700
Num Generations8
Temperature1.0
Beta (KL coefficient)0.04

LoRA Configuration

ParameterValue
LoRA Rank (r)32
LoRA Alpha64
LoRA Dropout0.05

Training Settings

ParameterValue
Logging Steps1
Save Steps100

Usage

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "kiranpg/Qwen2.5-OCamler-1.5B-Instruct-v2"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")

messages = [
    {"role": "user", "content": "Write an OCaml function to compute the factorial of a number."}
]

text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Intended Use

This model is designed for generating OCaml code solutions given natural language problem descriptions. It has been fine-tuned on OCaml programming problems to improve its ability to produce correct, idiomatic OCaml code.

Limitations

  • —The model may not always produce syntactically correct OCaml code
  • —Complex algorithmic problems may require multiple attempts
  • —The model works best with clear, well-specified problem descriptions

Training Infrastructure

Trained using TRL's GRPOTrainer with LoRA adapters.