Qwen3 4B Thinking - Document Creation Tools
Fine-tuned Qwen3-4B-Thinking-2507 model for creating Word documents (.docx) and Excel files (.xlsx) using JavaScript code generation.
π― Capabilities
- β Create Word documents with proper formatting
- β Generate tables and bullet/numbered lists
- β Apply text styling (bold, italic, colors, fonts)
- β Convert Markdown to formatted Word documents
- β Add headers, footers, and page numbers
π Usage
Quick Start
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"your-username/qwen3-4b-docx-tools",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("your-username/qwen3-4b-docx-tools")
# Prepare your prompt
messages = [
{
"role": "user",
"content": "Create a Word document with the title 'Project Report' and three sections with headings. Save it as report.docx"
}
]
# Generate
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=1024,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=False)
print(response)
π‘ Example Prompts
Simple document:
Create a Word document with the title "Meeting Notes" and save it as meeting.docx
Markdown conversion:
Convert this markdown to Word:
# Main Title
## Section 1
- Point A
- Point B
Save as output.docx
π Training Details
- Base Model: Qwen/Qwen3-4B-Thinking-2507
- Training Method: Full model fine-tuning (merged)
- Training Data: 29 curated examples of document creation tasks
- Training Hardware: Kaggle T4 GPU (16GB VRAM)
- Training Time: ~2-3 minutes
- Framework: Unsloth + Hugging Face Transformers
Training Hyperparameters
- Learning Rate: 5e-5
- Epochs: 3
- Batch Size: 2 (effective: 8 with gradient accumulation)
- Max Sequence Length: 1024 tokens
- Optimizer: AdamW 8-bit
- LR Scheduler: Cosine
- Weight Decay: 0.05
π¦ Model Size
- Parameters: ~4B
- Model Size: ~8GB (FP16)
π οΈ Requirements
pip install transformers torch docx
# Or for faster inference:
pip install unsloth
β οΈ Limitations
- Trained specifically for document creation tasks
- Requires JavaScript execution environment for generated code
- Limited to 29 training examples (may need more data for edge cases)
π License
This model inherits the license from Qwen3-4B-Thinking-2507 (Apache 2.0).
Note: This model generates JavaScript code. Ensure you have a proper execution environment with Node.js and required npm packages installed.
- Downloads last month
- 14