Instructions to use rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct") model = PeftModel.from_pretrained(base_model, "rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter") - Notebooks
- Google Colab
- Kaggle
Qwen2.5-Coder-7B — Federated FlowerTune Adapter (FedProx + DoRA)
A DoRA adapter for Qwen/Qwen2.5-Coder-7B-Instruct fine-tuned on code instruction-following data using federated learning via the Flower framework with the FedProx strategy. This is an adapter only — the base model weights are unchanged.
Model Details
- Finetuned by: Rishab Balakrishnan
- Model type: DoRA (Weight-Decomposed Low-Rank Adaptation) adapter
- Language(s): English (code-focused)
- License: Apache 2.0
- Finetuned from: Qwen/Qwen2.5-Coder-7B-Instruct
- Repository: Rishab26/flower-autoresearch
How to Get Started with the Model
This is a PEFT adapter, not a standalone model. You must load it on top of the base model.
Adapter only (recommended)
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base_model_id = "Qwen/Qwen2.5-Coder-7B-Instruct"
adapter_id = "rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter"
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(
base_model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
)
model = PeftModel.from_pretrained(base, adapter_id)
model.eval()
inputs = tokenizer("Write a Python function to reverse a linked list:", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Merging the adapter into the base model
If you want a single standalone model without a PEFT dependency:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base_model_id = "Qwen/Qwen2.5-Coder-7B-Instruct"
adapter_id = "rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter"
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(
base_model_id, torch_dtype=torch.float16, device_map="auto", trust_remote_code=True
)
model = PeftModel.from_pretrained(base, adapter_id)
model = model.merge_and_unload() # merges adapter weights into base
model.save_pretrained("./merged_model")
tokenizer.save_pretrained("./merged_model")
Training Details
Training Data
flwrlabs/code-alpaca-20k — 20k code instruction-following examples, partitioned across 4 federated clients using IID partitioning.
Training Procedure
Fine-tuned using federated learning with the Flower framework. Clients train locally using a custom FedProx trainer (proximal term µ=0.01) to penalise client drift, and only adapter weights are aggregated via FedAvg — no raw data ever leaves the client. Training used a warm-start from a prior checkpoint, with cosine learning rate decay across rounds.
Training Hyperparameters
| Hyperparameter | Value |
|---|---|
| Training regime | bf16 mixed precision |
| Optimizer | paged_adamw_8bit |
| Learning rate | cosine decay 8e-5 → 1e-6 |
| Per-device batch size | 4 |
| Max sequence length | 512 |
| Local steps per round | 20 |
| FL rounds | 80 |
| FL clients | 4 (IID partition, 50% sampled per round) |
| FL strategy | FedProx (proximal µ=0.01) |
| Warm start | Yes |
| Quantization | 4-bit QLoRA (bitsandbytes) |
| Gradient checkpointing | Yes |
DoRA / LoRA Configuration
| Parameter | Value |
|---|---|
| Rank (r) | 16 |
| Alpha | 64 |
| Dropout | 0.05 |
| Use DoRA | Yes |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, down_proj, up_proj |
Results
Best train loss of 0.0370 achieved at round 80 across 4 federated clients. Evaluated on the merged model using bigcode-evaluation-harness
| Benchmark | pass@1 |
|---|---|
| HumanEval | 64.63% |
| MBPP | 64.60% |
| MultiPL-E (JavaScript) | 70.81% |
| MultiPL-E (C++) | 64.60% |
| Average | 66.16% |
Framework Versions
- PEFT 0.14.0
- Transformers 4.50.0
- Flower (flwr) ≥ 1.27.0
- TRL 0.8.1
- bitsandbytes 0.45.5
- Downloads last month
- 5
Model tree for rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter
Dataset used to train rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter
Evaluation results
- pass@1 on HumanEvalself-reported64.630
- pass@1 on MBPPself-reported64.600
- pass@1 on MultiPL-E (JavaScript)self-reported70.810
- pass@1 on MultiPL-E (C++)self-reported64.600