Dedicated Endpoints

Run this model inference on single tenant GPU with unmatched speed and reliability at scale.

Learn more
Container

Run this model inference with full control and performance in your environment.

Learn more

Get help setting up a custom Dedicated Endpoints.

Talk with our engineer to get a quote for reserved GPU instances with discounts.

README

Model Details

Training Configuration & Hyperparameters

The model was fine-tuned using Hugging Face's TRL SFTTrainer and PEFT (LoRA) on Windows. The following hyperparameters were used:

LoRA Configurations

  • LoRA Rank (r): 16
  • LoRA Alpha (alpha): 32
  • LoRA Dropout: 0.05
  • Target Modules: gate_proj, down_proj, k_proj, q_proj, v_proj, up_proj, o_proj

Training Hyperparameters

  • Epochs: 3.0
  • Batch Size (per device): 2
  • Gradient Accumulation Steps: 4
  • Learning Rate: 2e-4
  • Warmup Steps: 5
  • Optimizer: 8-bit AdamW (adamw_8bit)
  • LR Scheduler: Linear
  • Sequence Length (max_seq_length): 2048

Dataset Format

The training pipeline extracted the problem description (content) and mapped it to the Python solution (python) under the Alpaca instruction format:

text

### Instruction:
[LeetCode Problem Description]
### Response:
[Python Code Solution and Explanation]

Quickstart / Inference

You can load and query this model directly using Hugging Face Transformers:

python

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))

Framework Versions

  • PEFT 0.19.1
  • TRL 0.24.0
  • Transformers 4.47.0 (or newer)
  • PyTorch 2.5.1+cu124
  • Datasets 3.3.0

Model provider

sriram279

Model tree

Base

AdithyaSK/Qwen-0.5b-Code-Reasoning-v1

Fine-tuned

this model

Modalities

Input

Text

Output

Text

Pricing

Dedicated Endpoints

View details

Supported Functionality

Model APIs

Dedicated Endpoints

Container

More information

Explore FriendliAI today