Downloads · 30 days
10
16% of all-time downloads
rishabbalakrishnan/qwen2.5-coder-7b-fed-flowertune-adapter
qwen2.5-coder-7b-fed-flowertune-adapter is a machine learning model from rishabbalakrishnan. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
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 wei…
Downloads · 30 days
10
16% of all-time downloads
All-time downloads
64
Public
Repo size
179 MB
Likes
0
Public
Click a slice to open those files.
.safetensors167 MB · 91%
From the Hugging Face model README
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.
This is a PEFT adapter, not a standalone model. You must load it on top of the base model.
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))
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")
flwrlabs/code-alpaca-20k — 20k code instruction-following examples, partitioned across 4 federated clients using IID partitioning.
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.
| 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 |
| 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 |
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% |