CoolFace
Modelpublic

KalvinPhan/MathCoder-VL-34bit

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
0likes4downloads
README.md213 linesDownload Raw Back to root
1---2tags:3- unsloth4base_model:5- Qwen/Qwen3-VL-2B-Instruct6license: apache-2.07pipeline_tag: image-text-to-text8library_name: transformers9---10<div>11<p style="margin-top: 0;margin-bottom: 0;">12    <em><a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0</a> achieves superior accuracy & outperforms other leading quants.</em>13  </p>14  <div style="display: flex; gap: 5px; align-items: center; ">15    <a href="https://github.com/unslothai/unsloth/">16      <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">17    </a>18    <a href="https://discord.gg/unsloth">19      <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">20    </a>21    <a href="https://docs.unsloth.ai/">22      <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">23    </a>24  </div>25</div>26 27<a href="https://huggingface.co/spaces/akhaliq/Qwen3-VL-2B-Instruct" target="_blank" style="margin: 2px;">28    <img alt="Demo" src="https://img.shields.io/badge/Demo-536af5" style="display: inline-block; vertical-align: middle;"/>29</a>30 31 32# Qwen3-VL-2B-Instruct33 34 35Meet Qwen3-VL — the most powerful vision-language model in the Qwen series to date.36 37This generation delivers comprehensive upgrades across the board: superior text understanding & generation, deeper visual perception & reasoning, extended context length, enhanced spatial and video dynamics comprehension, and stronger agent interaction capabilities.38 39Available in Dense and MoE architectures that scale from edge to cloud, with Instruct and reasoning‑enhanced Thinking editions for flexible, on‑demand deployment.40 41 42#### Key Enhancements:43 44* **Visual Agent**: Operates PC/mobile GUIs—recognizes elements, understands functions, invokes tools, completes tasks.45 46* **Visual Coding Boost**: Generates Draw.io/HTML/CSS/JS from images/videos.47 48* **Advanced Spatial Perception**: Judges object positions, viewpoints, and occlusions; provides stronger 2D grounding and enables 3D grounding for spatial reasoning and embodied AI.49 50* **Long Context & Video Understanding**: Native 256K context, expandable to 1M; handles books and hours-long video with full recall and second-level indexing.51 52* **Enhanced Multimodal Reasoning**: Excels in STEM/Math—causal analysis and logical, evidence-based answers.53 54* **Upgraded Visual Recognition**: Broader, higher-quality pretraining is able to “recognize everything”—celebrities, anime, products, landmarks, flora/fauna, etc.55 56* **Expanded OCR**: Supports 32 languages (up from 19); robust in low light, blur, and tilt; better with rare/ancient characters and jargon; improved long-document structure parsing.57 58* **Text Understanding on par with pure LLMs**: Seamless text–vision fusion for lossless, unified comprehension.59 60 61#### Model Architecture Updates:62 63<p align="center">64    <img src="https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-VL/qwen3vl_arc.jpg" width="80%"/>65<p>66 67 681. **Interleaved-MRoPE**: Full‑frequency allocation over time, width, and height via robust positional embeddings, enhancing long‑horizon video reasoning.69 702. **DeepStack**: Fuses multi‑level ViT features to capture fine‑grained details and sharpen image–text alignment.71 723. **Text–Timestamp Alignment:** Moves beyond T‑RoPE to precise, timestamp‑grounded event localization for stronger video temporal modeling.73 74This is the weight repository for Qwen3-VL-2B-Instruct.75 76 77---78 79## Model Performance80 81**Multimodal performance**82 83![](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-VL/qwen3vl_2b_32b_vl_instruct.jpg)84 85**Pure text performance**86![](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-VL/qwen3vl_2b_32b_text_instruct.jpg)87 88## Quickstart89 90Below, we provide simple examples to show how to use Qwen3-VL with 🤖 ModelScope and 🤗 Transformers.91 92The code of Qwen3-VL has been in the latest Hugging Face transformers and we advise you to build from source with command:93```94pip install git+https://github.com/huggingface/transformers95# pip install transformers==4.57.0 # currently, V4.57.0 is not released96```97 98### Using 🤗 Transformers to Chat99 100Here we show a code snippet to show how to use the chat model with `transformers`:101 102```python103from transformers import Qwen3VLForConditionalGeneration, AutoProcessor104 105# default: Load the model on the available device(s)106model = Qwen3VLForConditionalGeneration.from_pretrained(107    "Qwen/Qwen3-VL-2B-Instruct", dtype="auto", device_map="auto"108)109 110# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.111# model = Qwen3VLForConditionalGeneration.from_pretrained(112#     "Qwen/Qwen3-VL-2B-Instruct",113#     dtype=torch.bfloat16,114#     attn_implementation="flash_attention_2",115#     device_map="auto",116# )117 118processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-2B-Instruct")119 120messages = [121    {122        "role": "user",123        "content": [124            {125                "type": "image",126                "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",127            },128            {"type": "text", "text": "Describe this image."},129        ],130    }131]132 133# Preparation for inference134inputs = processor.apply_chat_template(135    messages,136    tokenize=True,137    add_generation_prompt=True,138    return_dict=True,139    return_tensors="pt"140)141inputs = inputs.to(model.device)142 143# Inference: Generation of the output144generated_ids = model.generate(**inputs, max_new_tokens=128)145generated_ids_trimmed = [146    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)147]148output_text = processor.batch_decode(149    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False150)151print(output_text)152```153 154### Generation Hyperparameters155#### VL156```bash157export greedy='false'158export top_p=0.8159export top_k=20160export temperature=0.7161export repetition_penalty=1.0162export presence_penalty=1.5163export out_seq_length=16384164```165 166#### Text167```bash168export greedy='false'169export top_p=1.0170export top_k=40171export repetition_penalty=1.0172export presence_penalty=2.0173export temperature=1.0174export out_seq_length=32768175```176 177 178## Citation179 180If you find our work helpful, feel free to give us a cite.181 182```183@misc{qwen3technicalreport,184      title={Qwen3 Technical Report}, 185      author={Qwen Team},186      year={2025},187      eprint={2505.09388},188      archivePrefix={arXiv},189      primaryClass={cs.CL},190      url={https://arxiv.org/abs/2505.09388}, 191}192 193@article{Qwen2.5-VL,194  title={Qwen2.5-VL Technical Report},195  author={Bai, Shuai and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Song, Sibo and Dang, Kai and Wang, Peng and Wang, Shijie and Tang, Jun and Zhong, Humen and Zhu, Yuanzhi and Yang, Mingkun and Li, Zhaohai and Wan, Jianqiang and Wang, Pengfei and Ding, Wei and Fu, Zheren and Xu, Yiheng and Ye, Jiabo and Zhang, Xi and Xie, Tianbao and Cheng, Zesen and Zhang, Hang and Yang, Zhibo and Xu, Haiyang and Lin, Junyang},196  journal={arXiv preprint arXiv:2502.13923},197  year={2025}198}199 200@article{Qwen2VL,201  title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},202  author={Wang, Peng and Bai, Shuai and Tan, Sinan and Wang, Shijie and Fan, Zhihao and Bai, Jinze and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Fan, Yang and Dang, Kai and Du, Mengfei and Ren, Xuancheng and Men, Rui and Liu, Dayiheng and Zhou, Chang and Zhou, Jingren and Lin, Junyang},203  journal={arXiv preprint arXiv:2409.12191},204  year={2024}205}206 207@article{Qwen-VL,208  title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},209  author={Bai, Jinze and Bai, Shuai and Yang, Shusheng and Wang, Shijie and Tan, Sinan and Wang, Peng and Lin, Junyang and Zhou, Chang and Zhou, Jingren},210  journal={arXiv preprint arXiv:2308.12966},211  year={2023}212}213```