Text Generation
PEFT
Safetensors
Transformers
lora
sft
writing-tools
summarisation
trl
conversational
Instructions to use Adi-cookieNmilk/writing-tools-qwen3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Adi-cookieNmilk/writing-tools-qwen3 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507") model = PeftModel.from_pretrained(base_model, "Adi-cookieNmilk/writing-tools-qwen3") - Transformers
How to use Adi-cookieNmilk/writing-tools-qwen3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Adi-cookieNmilk/writing-tools-qwen3") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Adi-cookieNmilk/writing-tools-qwen3", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Adi-cookieNmilk/writing-tools-qwen3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Adi-cookieNmilk/writing-tools-qwen3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Adi-cookieNmilk/writing-tools-qwen3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Adi-cookieNmilk/writing-tools-qwen3
- SGLang
How to use Adi-cookieNmilk/writing-tools-qwen3 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Adi-cookieNmilk/writing-tools-qwen3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Adi-cookieNmilk/writing-tools-qwen3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Adi-cookieNmilk/writing-tools-qwen3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Adi-cookieNmilk/writing-tools-qwen3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Adi-cookieNmilk/writing-tools-qwen3 with Docker Model Runner:
docker model run hf.co/Adi-cookieNmilk/writing-tools-qwen3
writing-tools-qwen3
LoRA adapter for Qwen3-4B-Instruct-2507, fine-tuned for three Apple Intelligence–style writing tasks:
- Summarise — concise paragraph summaries
- Rewrite — formal/casual tone rewrites
- Smart Reply — email replies as JSON (
subject,body,tone)
Approach
QLoRA 4-bit NF4 fine-tuning (r=16, α=32) on ~3.6k SFT examples. Part of writing-tools-nlp, which also implements speculative decoding, guided generation, and MLX on-device inference.
Evaluation (val split, n=400)
| Metric | Base Qwen3-4B | Fine-tuned |
|---|---|---|
| ROUGE-1 | 0.3877 | 0.5359 |
| ROUGE-2 | 0.1905 | 0.3788 |
| ROUGE-L | 0.3139 | 0.4838 |
| BERTScore-F1 | 0.8756 | 0.9136 |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = "Qwen/Qwen3-4B-Instruct-2507"
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto")
model = PeftModel.from_pretrained(model, "aditya-ice/writing-tools-qwen3")
tokenizer = AutoTokenizer.from_pretrained(base)
messages = [
{"role": "system", "content": "You are a writing assistant. Summarise the following text in one concise paragraph."},
{"role": "user", "content": "Your text here..."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Training
- Base model: Qwen/Qwen3-4B-Instruct-2507
- Method: QLoRA (peft + trl SFTTrainer)
- Data: CNN/DailyMail, PAWS, Enron emails (~4k examples)
- Hardware: Colab T4, 1 epoch
- Downloads last month
- 19
Model tree for Adi-cookieNmilk/writing-tools-qwen3
Base model
Qwen/Qwen3-4B-Instruct-2507