Views
No views yet
1CUDA_VISIBLE_DEVICES=0,1,2,3 \
2swift infer \
3 --model FutureMa/Qwen3.5-35B-A3B-LaTeX-OCR \
4 --use_hf true \
5 --stream true \
6 --experts_impl grouped_mm \
7 --device_map auto \
8 --max_new_tokens 20481from transformers import AutoModelForCausalLM, AutoProcessor
2
3model = AutoModelForCausalLM.from_pretrained(
4 "FutureMa/Qwen3.5-35B-A3B-LaTeX-OCR",
5 torch_dtype="bfloat16",
6 device_map="auto",
7 trust_remote_code=True
8)
9processor = AutoProcessor.from_pretrained(
10 "FutureMa/Qwen3.5-35B-A3B-LaTeX-OCR",
11 trust_remote_code=True
12)
13
14# Example usage with an image
15messages = [
16 {
17 "role": "user",
18 "content": [
19 {"type": "image", "image": "path/to/math_image.png"},
20 {"type": "text", "text": "Convert this handwritten math to LaTeX."}
21 ]
22 }
23]
24
25inputs = processor(messages, return_tensors="pt").to(model.device)
26outputs = model.generate(**inputs, max_new_tokens=512)
27result = processor.decode(outputs[0], skip_special_tokens=True)
28print(result)device_map auto (single-process multi-GPU, no DeepSpeed)| Metric | Value |
|---|---|
| Final Train Loss | ~0.001 |
| Final Token Accuracy | ~100% |
| Eval Loss | ~0.0006 |
1@misc{qwen3.5-latex-ocr-2026,
2 author = {FutureMa},
3 title = {Qwen3.5-35B-A3B-LaTeX-OCR: Fine-tuned Qwen3.5 for Handwritten LaTeX OCR},
4 year = {2026},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/FutureMa/Qwen3.5-35B-A3B-LaTeX-OCR}
7}