Add files using upload-large-folder tool
Browse files- .gitattributes +1 -0
- LICENSE.upstream.txt +54 -0
- NOTICE +6 -0
- PUBLISHING_CHECKLIST.md +13 -0
- README.md +59 -0
- UPSTREAM_MODEL_CARD.md +110 -0
- chat_template.jinja +7 -0
- chat_template.json +3 -0
- config.json +73 -0
- generation_config.json +12 -0
- model.safetensors +3 -0
- model.safetensors.index.json +0 -0
- preprocessor_config.json +19 -0
- processor_config.json +63 -0
- tokenizer.json +3 -0
- tokenizer_config.json +30 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
LICENSE.upstream.txt
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Qwen RESEARCH LICENSE AGREEMENT
|
| 2 |
+
|
| 3 |
+
Qwen RESEARCH LICENSE AGREEMENT Release Date: September 19, 2024
|
| 4 |
+
|
| 5 |
+
By clicking to agree or by using or distributing any portion or element of the Qwen Materials, you will be deemed to have recognized and accepted the content of this Agreement, which is effective immediately.
|
| 6 |
+
|
| 7 |
+
1. Definitions
|
| 8 |
+
a. This Qwen RESEARCH LICENSE AGREEMENT (this "Agreement") shall mean the terms and conditions for use, reproduction, distribution and modification of the Materials as defined by this Agreement.
|
| 9 |
+
b. "We" (or "Us") shall mean Alibaba Cloud.
|
| 10 |
+
c. "You" (or "Your") shall mean a natural person or legal entity exercising the rights granted by this Agreement and/or using the Materials for any purpose and in any field of use.
|
| 11 |
+
d. "Third Parties" shall mean individuals or legal entities that are not under common control with us or you.
|
| 12 |
+
e. "Qwen" shall mean the large language models, and software and algorithms, consisting of trained model weights, parameters (including optimizer states), machine-learning model code, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing distributed by us.
|
| 13 |
+
f. "Materials" shall mean, collectively, Alibaba Cloud's proprietary Qwen and Documentation (and any portion thereof) made available under this Agreement.
|
| 14 |
+
g. "Source" form shall mean the preferred form for making modifications, including but not limited to model source code, documentation source, and configuration files.
|
| 15 |
+
h. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
| 16 |
+
i. "Non-Commercial" shall mean for research or evaluation purposes only.
|
| 17 |
+
|
| 18 |
+
2. Grant of Rights
|
| 19 |
+
a. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Alibaba Cloud's intellectual property or other rights owned by us embodied in the Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Materials FOR NON-COMMERCIAL PURPOSES ONLY.
|
| 20 |
+
b. If you are commercially using the Materials, you shall request a license from us.
|
| 21 |
+
|
| 22 |
+
3. Redistribution
|
| 23 |
+
You may distribute copies or make the Materials, or derivative works thereof, available as part of a product or service that contains any of them, with or without modifications, and in Source or Object form, provided that you meet the following conditions:
|
| 24 |
+
a. You shall give any other recipients of the Materials or derivative works a copy of this Agreement;
|
| 25 |
+
b. You shall cause any modified files to carry prominent notices stating that you changed the files;
|
| 26 |
+
c. You shall retain in all copies of the Materials that you distribute the following attribution notices within a "Notice" text file distributed as a part of such copies: "Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved."; and
|
| 27 |
+
d. You may add your own copyright statement to your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of your modifications, or for any such derivative works as a whole, provided your use, reproduction, and distribution of the work otherwise complies with the terms and conditions of this Agreement.
|
| 28 |
+
|
| 29 |
+
4. Rules of use
|
| 30 |
+
a. The Materials may be subject to export controls or restrictions in China, the United States or other countries or regions. You shall comply with applicable laws and regulations in your use of the Materials.
|
| 31 |
+
b. If you use the Materials or any outputs or results therefrom to create, train, fine-tune, or improve an AI model that is distributed or made available, you shall prominently display “Built with Qwen” or “Improved using Qwen” in the related product documentation.
|
| 32 |
+
|
| 33 |
+
5. Intellectual Property
|
| 34 |
+
a. We retain ownership of all intellectual property rights in and to the Materials and derivatives made by or for us. Conditioned upon compliance with the terms and conditions of this Agreement, with respect to any derivative works and modifications of the Materials that are made by you, you are and will be the owner of such derivative works and modifications.
|
| 35 |
+
b. No trademark license is granted to use the trade names, trademarks, service marks, or product names of us, except as required to fulfill notice requirements under this Agreement or as required for reasonable and customary use in describing and redistributing the Materials.
|
| 36 |
+
c. If you commence a lawsuit or other proceedings (including a cross-claim or counterclaim in a lawsuit) against us or any entity alleging that the Materials or any output therefrom, or any part of the foregoing, infringe any intellectual property or other right owned or licensable by you, then all licenses granted to you under this Agreement shall terminate as of the date such lawsuit or other proceeding is commenced or brought.
|
| 37 |
+
|
| 38 |
+
6. Disclaimer of Warranty and Limitation of Liability
|
| 39 |
+
a. We are not obligated to support, update, provide training for, or develop any further version of the Qwen Materials or to grant any license thereto.
|
| 40 |
+
b. THE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. WE MAKE NO WARRANTY AND ASSUME NO RESPONSIBILITY FOR THE SAFETY OR STABILITY OF THE MATERIALS AND ANY OUTPUT THEREFROM.
|
| 41 |
+
c. IN NO EVENT SHALL WE BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE MATERIALS OR ANY OUTPUT OF IT, NO MATTER HOW IT’S CAUSED.
|
| 42 |
+
d. You will defend, indemnify and hold harmless us from and against any claim by any third party arising out of or related to your use or distribution of the Materials.
|
| 43 |
+
|
| 44 |
+
7. Survival and Termination.
|
| 45 |
+
a. The term of this Agreement shall commence upon your acceptance of this Agreement or access to the Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein.
|
| 46 |
+
b. We may terminate this Agreement if you breach any of the terms or conditions of this Agreement. Upon termination of this Agreement, you must delete and cease use of the Materials. Sections 6 and 8 shall survive the termination of this Agreement.
|
| 47 |
+
|
| 48 |
+
8. Governing Law and Jurisdiction.
|
| 49 |
+
a. This Agreement and any dispute arising out of or relating to it will be governed by the laws of China, without regard to conflict of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
|
| 50 |
+
b. The People's Courts in Hangzhou City shall have exclusive jurisdiction over any dispute arising out of this Agreement.
|
| 51 |
+
|
| 52 |
+
9. Other Terms and Conditions.
|
| 53 |
+
a. Any arrangements, understandings, or agreements regarding the Material not stated herein are separate from and independent of the terms and conditions of this Agreement. You shall request a separate license from us, if you use the Materials in ways not expressly agreed to in this Agreement.
|
| 54 |
+
b. We shall not be bound by any additional or different terms or conditions communicated by you unless expressly agreed.
|
NOTICE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved.
|
| 2 |
+
|
| 3 |
+
Additional notice for this derivative bundle:
|
| 4 |
+
- This repository may contain format conversions, quantization changes, and packaging changes.
|
| 5 |
+
- These changes do not replace or supersede the upstream model license.
|
| 6 |
+
- Documentation for any distributed derivative model should prominently state "Built with Qwen".
|
PUBLISHING_CHECKLIST.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Publishing Checklist
|
| 2 |
+
|
| 3 |
+
This checklist is intentionally conservative.
|
| 4 |
+
|
| 5 |
+
- [ ] I have confirmed my use is non-commercial research or evaluation use only.
|
| 6 |
+
- [ ] I have read the upstream license in `LICENSE.upstream.txt`.
|
| 7 |
+
- [ ] I have kept `NOTICE` in the bundle.
|
| 8 |
+
- [ ] I have retained attribution to Qwen / Alibaba Cloud.
|
| 9 |
+
- [ ] The model card prominently states "Built with Qwen".
|
| 10 |
+
- [ ] The model card clearly says the weights are a converted derivative of `hf_model`.
|
| 11 |
+
- [ ] I am not describing the converted weights as MIT-licensed.
|
| 12 |
+
- [ ] I understand Hugging Face publication can make the derivative broadly accessible.
|
| 13 |
+
- [ ] I have manually reviewed the generated files before upload.
|
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- mlx
|
| 4 |
+
- multimodal
|
| 5 |
+
- image-text-to-text
|
| 6 |
+
- document-parsing
|
| 7 |
+
- qwen2_5_vl
|
| 8 |
+
license: other
|
| 9 |
+
base_model:
|
| 10 |
+
- hf_model
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Dolphin-v2 MLX Conversion
|
| 14 |
+
|
| 15 |
+
This repository contains a local MLX conversion of `hf_model` intended for Apple Silicon inference.
|
| 16 |
+
|
| 17 |
+
## Important License Notice
|
| 18 |
+
|
| 19 |
+
The **code in this repository may be MIT-licensed**, but the **model weights are not MIT licensed**.
|
| 20 |
+
The converted weights remain subject to the upstream `Qwen RESEARCH LICENSE AGREEMENT`.
|
| 21 |
+
|
| 22 |
+
This bundle is provided for **non-commercial research or evaluation use only** unless you separately obtain commercial rights from the upstream licensors.
|
| 23 |
+
|
| 24 |
+
## Required Attribution
|
| 25 |
+
|
| 26 |
+
Built with Qwen
|
| 27 |
+
|
| 28 |
+
## Conversion Details
|
| 29 |
+
|
| 30 |
+
- Source model: `hf_model`
|
| 31 |
+
- Quantization: `4-bit / group size 64 / mode affine`
|
| 32 |
+
- Dtype: `bfloat16`
|
| 33 |
+
- Trust remote code: `False`
|
| 34 |
+
|
| 35 |
+
## Included Compliance Files
|
| 36 |
+
|
| 37 |
+
- `LICENSE.upstream.txt`
|
| 38 |
+
- `NOTICE`
|
| 39 |
+
- `UPSTREAM_MODEL_CARD.md`
|
| 40 |
+
- `PUBLISHING_CHECKLIST.md`
|
| 41 |
+
|
| 42 |
+
## Local Usage
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
uv run python -m mlx_vlm.generate \
|
| 46 |
+
--model . \
|
| 47 |
+
--max-tokens 512 \
|
| 48 |
+
--prompt "Parse the reading order of this document." \
|
| 49 |
+
--image /absolute/path/to/page.png
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Publishing Guidance
|
| 53 |
+
|
| 54 |
+
Before publishing, confirm that:
|
| 55 |
+
|
| 56 |
+
1. The intended release is non-commercial.
|
| 57 |
+
2. The upstream license and notice files are included.
|
| 58 |
+
3. Your model card prominently states `Built with Qwen`.
|
| 59 |
+
4. You clearly state that the repository contains converted derivative weights.
|
UPSTREAM_MODEL_CARD.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- zh
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- document-parsing
|
| 7 |
+
- document-understanding
|
| 8 |
+
- document-intelligence
|
| 9 |
+
- ocr
|
| 10 |
+
- layout-analysis
|
| 11 |
+
- table-extraction
|
| 12 |
+
- formula-recognition
|
| 13 |
+
- code-extraction
|
| 14 |
+
- multimodal
|
| 15 |
+
- vision-language-model
|
| 16 |
+
datasets:
|
| 17 |
+
- custom
|
| 18 |
+
pipeline_tag: image-text-to-text
|
| 19 |
+
library_name: transformers
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Dolphin-v2: Universal Document Parsing via Scalable Anchor Prompting
|
| 23 |
+
|
| 24 |
+
<a href="https://github.com/bytedance/Dolphin"><img src="https://img.shields.io/badge/Code-Github-blue"></a>
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
## Model Description
|
| 28 |
+
|
| 29 |
+
Dolphin-v2 is an enhanced universal document parsing model that substantially improves upon the original Dolphin. It seamlessly handles any document type—whether digital-born or photographed—through a document-type-aware two-stage architecture with scalable anchor prompting.
|
| 30 |
+
|
| 31 |
+
## 📑 Key Improvements
|
| 32 |
+
|
| 33 |
+
Dolphin-v2 introduces several major enhancements over the original Dolphin:
|
| 34 |
+
|
| 35 |
+
- **🌐 Universal Document Support**: Handles both digital-born and photographed documents with realistic distortions
|
| 36 |
+
- **📊 Expanded Element Coverage**: Supports 21 element categories (up from 14), including dedicated code blocks and formulas
|
| 37 |
+
- **🎯 Enhanced Precision**: Uses absolute pixel coordinates for more accurate spatial localization
|
| 38 |
+
- **⚡ Hybrid Parsing Strategy**: Element-wise parallel parsing for digital documents + holistic parsing for photographed documents
|
| 39 |
+
- **🔬 Specialized Modules**: Dedicated parsing for code blocks with indentation preservation
|
| 40 |
+
|
| 41 |
+
## 🏗️ Model Architecture
|
| 42 |
+
|
| 43 |
+
Dolphin-v2 follows a document-type-aware two-stage paradigm:
|
| 44 |
+
|
| 45 |
+
### Stage 1: Joint Classification and Layout Analysis
|
| 46 |
+
- **Document Type Classification**: Distinguishes between digital-born and photographed documents
|
| 47 |
+
- **Layout Analysis**: Generates element sequences in reading order with 21 supported categories
|
| 48 |
+
|
| 49 |
+
### Stage 2: Hybrid Content Parsing
|
| 50 |
+
- **Photographed Documents**: Holistic page-level parsing to handle distortions
|
| 51 |
+
- **Digital Documents**: Efficient element-wise parallel parsing with type-specific prompts
|
| 52 |
+
- `P_formula`: Specialized LaTeX generation for formulas
|
| 53 |
+
- `P_code`: Code block parsing with indentation preservation
|
| 54 |
+
- `P_table`: HTML representation for tables
|
| 55 |
+
- `P_paragraph`: Text recognition for paragraphs
|
| 56 |
+
|
| 57 |
+
Built on **Qwen2.5-VL-3B** backbone with:
|
| 58 |
+
- Vision encoder based on Native Resolution Vision Transformer (NaViT)
|
| 59 |
+
- Autoregressive decoder for structured output generation
|
| 60 |
+
|
| 61 |
+
## 📈 Performance
|
| 62 |
+
|
| 63 |
+
Dolphin-v2 achieves superior performance on comprehensive benchmarks:
|
| 64 |
+
**OmniDocBench (v1.5):**
|
| 65 |
+
- Overall Score: **89.45** (+14.78 over original Dolphin)
|
| 66 |
+
- Text Recognition: **0.054** Edit Distance
|
| 67 |
+
- Formula Parsing: **86.72** CDM
|
| 68 |
+
- Table Structure: **87.02** TEDS / **90.48** TEDS-S
|
| 69 |
+
- Reading Order: **0.054** Edit Distance
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
## 🎯 Supported Element Types
|
| 73 |
+
Dolphin-v2 supports 21 document element categories:
|
| 74 |
+
|
| 75 |
+
| Element Type | Description |
|
| 76 |
+
|--------------|-------------|
|
| 77 |
+
| `sec_0` - `sec_5` | Hierarchical headings (title, level 1-5) |
|
| 78 |
+
| `para` | Regular paragraphs |
|
| 79 |
+
| `half_para` | Spanning paragraphs |
|
| 80 |
+
| `equ` | Mathematical formulas (LaTeX) |
|
| 81 |
+
| `tab` | Tables (HTML) |
|
| 82 |
+
| `code` | Code blocks (with indentation) |
|
| 83 |
+
| `fig` | Figures |
|
| 84 |
+
| `cap` | Captions |
|
| 85 |
+
| `list` | Lists |
|
| 86 |
+
| `catalogue` | Catalogs |
|
| 87 |
+
| `reference` | References |
|
| 88 |
+
| `header` / `foot` | Headers/Footers |
|
| 89 |
+
| `fnote` | Footnotes |
|
| 90 |
+
| `watermark` | Watermarks |
|
| 91 |
+
| `anno` | Annotations |
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
## 📚 Citation
|
| 95 |
+
```bibtex
|
| 96 |
+
@inproceedings{dolphin2025,
|
| 97 |
+
title={Dolphin: Document Image Parsing via Heterogeneous Anchor Prompting},
|
| 98 |
+
author={Feng, Hao and Wei, Shu and Fei, Xiang and Shi, Wei and Han, Yingdong and Liao, Lei and Lu, Jinghui and Wu, Binghong and Liu, Qi and Lin, Chunhui and Tang, Jingqun and Liu, Hao and Huang, Can},
|
| 99 |
+
booktitle={Proceedings of the 65th Annual Meeting of the Association for Computational Linguistics (ACL)},
|
| 100 |
+
year={2025}
|
| 101 |
+
}
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## 🙏 Acknowledgements
|
| 105 |
+
|
| 106 |
+
This model builds upon:
|
| 107 |
+
- [Hugging Face Transformers](https://github.com/huggingface/transformers)
|
| 108 |
+
- [Qwen2.5-VL](https://github.com/QwenLM/Qwen2-VL)
|
| 109 |
+
- [Donut](https://github.com/clovaai/donut/)
|
| 110 |
+
- [Nougat](https://github.com/facebookresearch/nougat)
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
|
| 2 |
+
You are a helpful assistant.<|im_end|>
|
| 3 |
+
{% endif %}<|im_start|>{{ message['role'] }}
|
| 4 |
+
{% if message['content'] is string %}{{ message['content'] }}<|im_end|>
|
| 5 |
+
{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>
|
| 6 |
+
{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 7 |
+
{% endif %}
|
chat_template.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
|
| 3 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen2_5_VLForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": 151643,
|
| 7 |
+
"eos_token_id": [
|
| 8 |
+
151645,
|
| 9 |
+
151643
|
| 10 |
+
],
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 2048,
|
| 13 |
+
"image_token_id": 151655,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 11008,
|
| 16 |
+
"max_position_embeddings": 128000,
|
| 17 |
+
"max_window_layers": 70,
|
| 18 |
+
"model_type": "qwen2_5_vl",
|
| 19 |
+
"num_attention_heads": 16,
|
| 20 |
+
"num_hidden_layers": 36,
|
| 21 |
+
"num_key_value_heads": 2,
|
| 22 |
+
"quantization": {
|
| 23 |
+
"group_size": 64,
|
| 24 |
+
"bits": 4,
|
| 25 |
+
"mode": "affine"
|
| 26 |
+
},
|
| 27 |
+
"quantization_config": {
|
| 28 |
+
"group_size": 64,
|
| 29 |
+
"bits": 4,
|
| 30 |
+
"mode": "affine"
|
| 31 |
+
},
|
| 32 |
+
"rms_norm_eps": 1e-06,
|
| 33 |
+
"rope_scaling": {
|
| 34 |
+
"type": "mrope",
|
| 35 |
+
"mrope_section": [
|
| 36 |
+
16,
|
| 37 |
+
24,
|
| 38 |
+
24
|
| 39 |
+
]
|
| 40 |
+
},
|
| 41 |
+
"rope_theta": 1000000.0,
|
| 42 |
+
"sliding_window": 32768,
|
| 43 |
+
"tie_word_embeddings": true,
|
| 44 |
+
"transformers_version": "4.41.2",
|
| 45 |
+
"use_cache": true,
|
| 46 |
+
"use_sliding_window": false,
|
| 47 |
+
"video_token_id": 151656,
|
| 48 |
+
"vision_config": {
|
| 49 |
+
"depth": 32,
|
| 50 |
+
"hidden_act": "silu",
|
| 51 |
+
"hidden_size": 1280,
|
| 52 |
+
"intermediate_size": 3420,
|
| 53 |
+
"num_heads": 16,
|
| 54 |
+
"in_chans": 3,
|
| 55 |
+
"out_hidden_size": 2048,
|
| 56 |
+
"patch_size": 14,
|
| 57 |
+
"spatial_merge_size": 2,
|
| 58 |
+
"spatial_patch_size": 14,
|
| 59 |
+
"window_size": 112,
|
| 60 |
+
"fullatt_block_indexes": [
|
| 61 |
+
7,
|
| 62 |
+
15,
|
| 63 |
+
23,
|
| 64 |
+
31
|
| 65 |
+
],
|
| 66 |
+
"tokens_per_second": 2,
|
| 67 |
+
"temporal_patch_size": 2
|
| 68 |
+
},
|
| 69 |
+
"vision_end_token_id": 151653,
|
| 70 |
+
"vision_start_token_id": 151652,
|
| 71 |
+
"vision_token_id": 151654,
|
| 72 |
+
"vocab_size": 151936
|
| 73 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"pad_token_id": 151643,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
151645,
|
| 7 |
+
151643
|
| 8 |
+
],
|
| 9 |
+
"repetition_penalty": 1.05,
|
| 10 |
+
"temperature": 0.000001,
|
| 11 |
+
"transformers_version": "4.49.0"
|
| 12 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:733418eb4fbc54f25d41d8cf65877b56c4cabc15d144f7dd34748ba99155832d
|
| 3 |
+
size 3073721056
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"min_pixels": 3136,
|
| 3 |
+
"max_pixels": 12845056,
|
| 4 |
+
"patch_size": 14,
|
| 5 |
+
"temporal_patch_size": 2,
|
| 6 |
+
"merge_size": 2,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.48145466,
|
| 9 |
+
0.4578275,
|
| 10 |
+
0.40821073
|
| 11 |
+
],
|
| 12 |
+
"image_std": [
|
| 13 |
+
0.26862954,
|
| 14 |
+
0.26130258,
|
| 15 |
+
0.27577711
|
| 16 |
+
],
|
| 17 |
+
"image_processor_type": "Qwen2VLImageProcessor",
|
| 18 |
+
"processor_class": "Qwen2_5_VLProcessor"
|
| 19 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"data_format": "channels_first",
|
| 4 |
+
"do_convert_rgb": true,
|
| 5 |
+
"do_normalize": true,
|
| 6 |
+
"do_rescale": true,
|
| 7 |
+
"do_resize": true,
|
| 8 |
+
"image_mean": [
|
| 9 |
+
0.48145466,
|
| 10 |
+
0.4578275,
|
| 11 |
+
0.40821073
|
| 12 |
+
],
|
| 13 |
+
"image_processor_type": "Qwen2VLImageProcessorFast",
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.26862954,
|
| 16 |
+
0.26130258,
|
| 17 |
+
0.27577711
|
| 18 |
+
],
|
| 19 |
+
"merge_size": 2,
|
| 20 |
+
"patch_size": 14,
|
| 21 |
+
"resample": 3,
|
| 22 |
+
"rescale_factor": 0.00392156862745098,
|
| 23 |
+
"size": {
|
| 24 |
+
"longest_edge": 12845056,
|
| 25 |
+
"shortest_edge": 3136
|
| 26 |
+
},
|
| 27 |
+
"temporal_patch_size": 2
|
| 28 |
+
},
|
| 29 |
+
"processor_class": "Qwen2_5_VLProcessor",
|
| 30 |
+
"video_processor": {
|
| 31 |
+
"data_format": "channels_first",
|
| 32 |
+
"default_to_square": true,
|
| 33 |
+
"do_convert_rgb": true,
|
| 34 |
+
"do_normalize": true,
|
| 35 |
+
"do_rescale": true,
|
| 36 |
+
"do_resize": true,
|
| 37 |
+
"do_sample_frames": false,
|
| 38 |
+
"image_mean": [
|
| 39 |
+
0.48145466,
|
| 40 |
+
0.4578275,
|
| 41 |
+
0.40821073
|
| 42 |
+
],
|
| 43 |
+
"image_processor_type": "Qwen2VLImageProcessor",
|
| 44 |
+
"image_std": [
|
| 45 |
+
0.26862954,
|
| 46 |
+
0.26130258,
|
| 47 |
+
0.27577711
|
| 48 |
+
],
|
| 49 |
+
"max_frames": 768,
|
| 50 |
+
"merge_size": 2,
|
| 51 |
+
"min_frames": 4,
|
| 52 |
+
"patch_size": 14,
|
| 53 |
+
"resample": 3,
|
| 54 |
+
"rescale_factor": 0.00392156862745098,
|
| 55 |
+
"return_metadata": false,
|
| 56 |
+
"size": {
|
| 57 |
+
"longest_edge": 12845056,
|
| 58 |
+
"shortest_edge": 3136
|
| 59 |
+
},
|
| 60 |
+
"temporal_patch_size": 2,
|
| 61 |
+
"video_processor_type": "Qwen2VLVideoProcessor"
|
| 62 |
+
}
|
| 63 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8
|
| 3 |
+
size 11421892
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": true,
|
| 24 |
+
"model_max_length": 131072,
|
| 25 |
+
"pad_token": "<|endoftext|>",
|
| 26 |
+
"processor_class": "Qwen2_5_VLProcessor",
|
| 27 |
+
"split_special_tokens": false,
|
| 28 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
| 30 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|