Instructions to use amiya/qwen2.5-7b-gec-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use amiya/qwen2.5-7b-gec-v3 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("amiya/qwen2.5-7b-gec-v3") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use amiya/qwen2.5-7b-gec-v3 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-7b-gec-v3"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "amiya/qwen2.5-7b-gec-v3" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use amiya/qwen2.5-7b-gec-v3 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-7b-gec-v3"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "amiya/qwen2.5-7b-gec-v3" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use amiya/qwen2.5-7b-gec-v3 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "amiya/qwen2.5-7b-gec-v3"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "amiya/qwen2.5-7b-gec-v3" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amiya/qwen2.5-7b-gec-v3", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use amiya/qwen2.5-7b-gec-v3 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-7b-gec-v3"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default amiya/qwen2.5-7b-gec-v3
Run Hermes
hermes
qwen2.5-7b-gec-v3
LoRA fine-tune of Qwen/Qwen2.5-7B-Instruct for English grammatical error correction (GEC). LoRA was trained against the 4-bit MLX quantization of the base, then fused and dequantized to bf16 for distribution. +0.018 F0.5 over the 3B v2 model on the same held-out BEA-dev split.
Results
ERRANT scores on a 100-sample held-out BEA-dev split (ABCN.dev.gold.bea19.m2, identity rows skipped, post-process: trailing-space-punct + space-collapse + leading-cap):
| Model | Precision | Recall | F0.5 |
|---|---|---|---|
| v1 (3B, BEA only) | 0.543 | 0.365 | 0.495 |
| v2 (3B, BEA+Coedit) | 0.589 | 0.386 | 0.533 |
| v3 (7B, BEA+Coedit+Owishiboo+sarayusapa) | 0.622 | 0.378 | 0.551 |
Best snapshot: iter 4000 (val 0.252). Training also tested iter 1000 (0.504), iter 2500 (0.532), iter 5000 (0.535).
Use
from mlx_lm import generate, load
model, tokenizer = load("amiya/qwen2.5-7b-gec-v3")
prompt = tokenizer.apply_chat_template(
[
{"role": "system", "content": "Correct the grammar of the user text. Preserve meaning."},
{"role": "user", "content": "He go to school"},
],
tokenize=False,
add_generation_prompt=True,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=80))
# -> "He goes to school"
PyTorch users: transformers.AutoModelForCausalLM.from_pretrained("amiya/qwen2.5-7b-gec-v3") works the same.
System prompt
Correct the grammar of the user text. Preserve meaning.
Use that exact prompt. Chat template is Qwen ChatML.
Recommended decoding
- Greedy (temperature 0)
max_new_tokens~ 1.5× the prompt length- Single-pass; iterative re-feed did not help on the v2 ablation
- Post-processor (
scripts/eval_mlx_gec.py --post-processin the source repo) is worth +0.01–0.02 F0.5
Training
- Base:
mlx-community/Qwen2.5-7B-Instruct-4bit(4-bit quantised) — fused weights here are dequantised to bf16 - LoRA: rank 16, alpha 32, dropout 0.05, all 28 layers, 40.37 M trainable (0.53 %)
- Optimizer: AdamW, lr 1e-5 (5× lower than v2 to keep Q4 base stable — 5e-5 diverged)
- Batch size: 2, max sequence 256
- Iters: 5,000 (best at iter 4000)
- Hardware: Apple M2 Max, 32 GB unified RAM, mlx-lm v0.31.3
- Wall-clock: ~60 minutes, peak memory 12 GB
Data
| Source | Pairs | Notes |
|---|---|---|
| BEA-2019 W&I+LOCNESS train | 22,668 | minimal-edit gold |
Grammarly Coedit task=gec |
19,823 | instruction-tuned GEC |
| Owishiboo/grammar-correction | 5,099 | small but clean |
| sarayusapa/Grammar_Error_Correction | 40,000 (capped) | larger, Asian-learner |
| Total train | 86,715 | |
| Validation | 875 | random split |
Identity rows dropped; sentences over 50 words dropped from sarayusapa to keep distribution focused.
Smoke samples
| Input | Output |
|---|---|
He go to school |
He goes to school |
I are happy |
I am happy |
she walk fast |
She walks fast. |
they was tired yesterday |
They were tired yesterday. |
she have a cat |
She has a cat. |
Limitations
- F0.5 = 0.551 is still below GECToR's 0.65+ paper benchmark. Closing the gap further needs NUCLE + FCE + Lang-8 (license-gated) plus the multi-stage curriculum (synthetic pretrain → BEA → W&I+L finetune).
- The fused model here is dequantised to bf16 (~14 GB). For inference-only deployment, re-quantise with
mlx_lm.convert -q --q-bits 4. - English only.
- Trained on ≤ 256-token sequences; long inputs may degrade.
Citation
@misc{qwen25_7b_gec_v3,
title = {qwen2.5-7b-gec-v3: LoRA-tuned Qwen2.5-7B for English GEC},
author = {amiya},
year = {2026},
url = {https://huggingface.co/amiya/qwen2.5-7b-gec-v3}
}
Datasets: Bryant et al. BEA-2019 Shared Task. Raheja et al. CoEdIT. Owishiboo, sarayusapa public HF datasets.
- Downloads last month
- 8
Quantized