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
6
Safetensors
Model size
4B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Mewmew25/Qwen3-4B-Thinking-2507-DocxTrained

Finetuned
(156)
this model
Quantizations
1 model