Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- LICENSE +88 -0
- README.md +65 -0
- acc_vs_latency_qwen-2.png +3 -0
- added_tokens.json +5 -0
- config.json +45 -0
- generation_config.json +6 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- special_tokens_map.json +20 -0
- tokenizer_config.json +44 -0
- trainer_state.json +0 -0
- training_args.bin +3 -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 |
+
acc_vs_latency_qwen-2.png filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Disclaimer: IMPORTANT: This Apple Machine Learning Research Model is
|
2 |
+
specifically developed and released by Apple Inc. ("Apple") for the sole purpose
|
3 |
+
of scientific research of artificial intelligence and machine-learning
|
4 |
+
technology. “Apple Machine Learning Research Model” means the model, including
|
5 |
+
but not limited to algorithms, formulas, trained model weights, parameters,
|
6 |
+
configurations, checkpoints, and any related materials (including
|
7 |
+
documentation).
|
8 |
+
|
9 |
+
This Apple Machine Learning Research Model is provided to You by
|
10 |
+
Apple in consideration of your agreement to the following terms, and your use,
|
11 |
+
modification, creation of Model Derivatives, and or redistribution of the Apple
|
12 |
+
Machine Learning Research Model constitutes acceptance of this Agreement. If You
|
13 |
+
do not agree with these terms, please do not use, modify, create Model
|
14 |
+
Derivatives of, or distribute this Apple Machine Learning Research Model or
|
15 |
+
Model Derivatives.
|
16 |
+
|
17 |
+
* License Scope: In consideration of your agreement to abide by the following
|
18 |
+
terms, and subject to these terms, Apple hereby grants you a personal,
|
19 |
+
non-exclusive, worldwide, non-transferable, royalty-free, revocable, and
|
20 |
+
limited license, to use, copy, modify, distribute, and create Model
|
21 |
+
Derivatives (defined below) of the Apple Machine Learning Research Model
|
22 |
+
exclusively for Research Purposes. You agree that any Model Derivatives You
|
23 |
+
may create or that may be created for You will be limited to Research Purposes
|
24 |
+
as well. “Research Purposes” means non-commercial scientific research and
|
25 |
+
academic development activities, such as experimentation, analysis, testing
|
26 |
+
conducted by You with the sole intent to advance scientific knowledge and
|
27 |
+
research. “Research Purposes” does not include any commercial exploitation,
|
28 |
+
product development or use in any commercial product or service.
|
29 |
+
|
30 |
+
* Distribution of Apple Machine Learning Research Model and Model Derivatives:
|
31 |
+
If you choose to redistribute Apple Machine Learning Research Model or its
|
32 |
+
Model Derivatives, you must provide a copy of this Agreement to such third
|
33 |
+
party, and ensure that the following attribution notice be provided: “Apple
|
34 |
+
Machine Learning Research Model is licensed under the Apple Machine Learning
|
35 |
+
Research Model License Agreement.” Additionally, all Model Derivatives must
|
36 |
+
clearly be identified as such, including disclosure of modifications and
|
37 |
+
changes made to the Apple Machine Learning Research Model. The name,
|
38 |
+
trademarks, service marks or logos of Apple may not be used to endorse or
|
39 |
+
promote Model Derivatives or the relationship between You and Apple. “Model
|
40 |
+
Derivatives” means any models or any other artifacts created by modifications,
|
41 |
+
improvements, adaptations, alterations to the architecture, algorithm or
|
42 |
+
training processes of the Apple Machine Learning Research Model, or by any
|
43 |
+
retraining, fine-tuning of the Apple Machine Learning Research Model.
|
44 |
+
|
45 |
+
* No Other License: Except as expressly stated in this notice, no other rights
|
46 |
+
or licenses, express or implied, are granted by Apple herein, including but
|
47 |
+
not limited to any patent, trademark, and similar intellectual property rights
|
48 |
+
worldwide that may be infringed by the Apple Machine Learning Research Model,
|
49 |
+
the Model Derivatives or by other works in which the Apple Machine Learning
|
50 |
+
Research Model may be incorporated.
|
51 |
+
|
52 |
+
* Compliance with Laws: Your use of Apple Machine Learning Research Model must
|
53 |
+
be in compliance with all applicable laws and regulations.
|
54 |
+
|
55 |
+
* Term and Termination: The term of this Agreement will begin upon your
|
56 |
+
acceptance of this Agreement or use of the Apple Machine Learning Research
|
57 |
+
Model and will continue until terminated in accordance with the following
|
58 |
+
terms. Apple may terminate this Agreement at any time if You are in breach of
|
59 |
+
any term or condition of this Agreement. Upon termination of this Agreement,
|
60 |
+
You must cease to use all Apple Machine Learning Research Models and Model
|
61 |
+
Derivatives and permanently delete any copy thereof. Sections 3, 6 and 7 will
|
62 |
+
survive termination.
|
63 |
+
|
64 |
+
* Disclaimer and Limitation of Liability: This Apple Machine Learning Research
|
65 |
+
Model and any outputs generated by the Apple Machine Learning Research Model
|
66 |
+
are provided on an “AS IS” basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
|
67 |
+
IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
|
68 |
+
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
|
69 |
+
REGARDING THE APPLE MACHINE LEARNING RESEARCH MODEL OR OUTPUTS GENERATED BY
|
70 |
+
THE APPLE MACHINE LEARNING RESEARCH MODEL. You are solely responsible for
|
71 |
+
determining the appropriateness of using or redistributing the Apple Machine
|
72 |
+
Learning Research Model and any outputs of the Apple Machine Learning Research
|
73 |
+
Model and assume any risks associated with Your use of the Apple Machine
|
74 |
+
Learning Research Model and any output and results. IN NO EVENT SHALL APPLE BE
|
75 |
+
LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
76 |
+
IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF
|
77 |
+
THE APPLE MACHINE LEARNING RESEARCH MODEL AND ANY OUTPUTS OF THE APPLE MACHINE
|
78 |
+
LEARNING RESEARCH MODEL, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
|
79 |
+
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS
|
80 |
+
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
81 |
+
|
82 |
+
* Governing Law: This Agreement will be governed by and construed under the laws
|
83 |
+
of the State of California without regard to its choice of law principles. The
|
84 |
+
Convention on Contracts for the International Sale of Goods shall not apply to
|
85 |
+
the Agreement except that the arbitration clause and any arbitration hereunder
|
86 |
+
shall be governed by the Federal Arbitration Act, Chapters 1 and 2.
|
87 |
+
|
88 |
+
Copyright (C) 2025 Apple Inc. All Rights Reserved.
|
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apple-amlr
|
3 |
+
license_name: apple-ascl
|
4 |
+
license_link: https://github.com/apple/ml-fastvlm/blob/main/LICENSE_MODEL
|
5 |
+
library_name: ml-fastvlm
|
6 |
+
---
|
7 |
+
# FastVLM: Efficient Vision Encoding for Vision Language Models
|
8 |
+
|
9 |
+
FastVLM was introduced in
|
10 |
+
**[FastVLM: Efficient Vision Encoding for Vision Language Models](https://www.arxiv.org/abs/2412.13303). (CVPR 2025)**
|
11 |
+
|
12 |
+
[//]: # ()
|
13 |
+
<p align="center">
|
14 |
+
<img src="acc_vs_latency_qwen-2.png" alt="Accuracy vs latency figure." width="400"/>
|
15 |
+
</p>
|
16 |
+
|
17 |
+
### Highlights
|
18 |
+
* We introduce FastViTHD, a novel hybrid vision encoder designed to output fewer tokens and significantly reduce encoding time for high-resolution images.
|
19 |
+
* Our smallest variant outperforms LLaVA-OneVision-0.5B with 85x faster Time-to-First-Token (TTFT) and 3.4x smaller vision encoder.
|
20 |
+
* Our larger variants using Qwen2-7B LLM outperform recent works like Cambrian-1-8B while using a single image encoder with a 7.9x faster TTFT.
|
21 |
+
|
22 |
+
|
23 |
+
### Evaluations
|
24 |
+
| Benchmark | FastVLM-0.5B | FastVLM-1.5B | FastVLM-7B |
|
25 |
+
|:--------------|:------------:|:------------:|:----------:|
|
26 |
+
| Ai2D | 68.0 | 77.4 | 83.6 |
|
27 |
+
| ScienceQA | 85.2 | 94.4 | 96.7 |
|
28 |
+
| MMMU | 33.9 | 37.8 | 45.4 |
|
29 |
+
| VQAv2 | 76.3 | 79.1 | 80.8 |
|
30 |
+
| ChartQA | 76.0 | 80.1 | 85.0 |
|
31 |
+
| TextVQA | 64.5 | 70.4 | 74.9 |
|
32 |
+
| InfoVQA | 46.4 | 59.7 | 75.8 |
|
33 |
+
| DocVQA | 82.5 | 88.3 | 93.2 |
|
34 |
+
| OCRBench | 63.9 | 70.2 | 73.1 |
|
35 |
+
| RealWorldQA | 56.1 | 61.2 | 67.2 |
|
36 |
+
| SeedBench-Img | 71.0 | 74.2 | 75.4 |
|
37 |
+
|
38 |
+
|
39 |
+
### Usage Example
|
40 |
+
To run inference of PyTorch checkpoint, follow the instruction in the official repo:
|
41 |
+
|
42 |
+
Download the model
|
43 |
+
```
|
44 |
+
huggingface-cli download apple/FastVLM-1.5B
|
45 |
+
```
|
46 |
+
|
47 |
+
Run inference using `predict.py` from the official repo.
|
48 |
+
```bash
|
49 |
+
python predict.py --model-path /path/to/checkpoint-dir \
|
50 |
+
--image-file /path/to/image.png \
|
51 |
+
--prompt "Describe the image."
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
+
## Citation
|
56 |
+
If you found this model useful, please cite the following paper:
|
57 |
+
```
|
58 |
+
@InProceedings{fastvlm2025,
|
59 |
+
author = {Pavan Kumar Anasosalu Vasu, Fartash Faghri, Chun-Liang Li, Cem Koc, Nate True, Albert Antony, Gokul Santhanam, James Gabriel, Peter Grasch, Oncel Tuzel, Hadi Pouransari},
|
60 |
+
title = {FastVLM: Efficient Vision Encoding for Vision Language Models},
|
61 |
+
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
|
62 |
+
month = {June},
|
63 |
+
year = {2025},
|
64 |
+
}
|
65 |
+
```
|
acc_vs_latency_qwen-2.png
ADDED
![]() |
Git LFS Details
|
added_tokens.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<|endoftext|>": 151643,
|
3 |
+
"<|im_end|>": 151645,
|
4 |
+
"<|im_start|>": 151644
|
5 |
+
}
|
config.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "./llava-v1.5-13b",
|
3 |
+
"architectures": [
|
4 |
+
"LlavaQwen2ForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 151643,
|
8 |
+
"eos_token_id": 151645,
|
9 |
+
"freeze_mm_mlp_adapter": false,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 1536,
|
12 |
+
"image_aspect_ratio": "pad",
|
13 |
+
"image_grid_pinpoints": null,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"intermediate_size": 8960,
|
16 |
+
"max_position_embeddings": 32768,
|
17 |
+
"max_window_layers": 28,
|
18 |
+
"mm_hidden_size": 3072,
|
19 |
+
"mm_patch_merge_type": "flat",
|
20 |
+
"mm_projector_lr": null,
|
21 |
+
"mm_projector_type": "mlp2x_gelu",
|
22 |
+
"mm_use_im_patch_token": false,
|
23 |
+
"mm_use_im_start_end": false,
|
24 |
+
"mm_vision_select_feature": "patch",
|
25 |
+
"mm_vision_select_layer": -2,
|
26 |
+
"mm_vision_tower": "mobileclip_l_1024",
|
27 |
+
"model_type": "llava_qwen2",
|
28 |
+
"num_attention_heads": 12,
|
29 |
+
"num_hidden_layers": 28,
|
30 |
+
"num_key_value_heads": 2,
|
31 |
+
"rms_norm_eps": 1e-06,
|
32 |
+
"rope_theta": 1000000.0,
|
33 |
+
"sliding_window": 32768,
|
34 |
+
"tie_word_embeddings": true,
|
35 |
+
"tokenizer_model_max_length": 8192,
|
36 |
+
"tokenizer_padding_side": "right",
|
37 |
+
"torch_dtype": "bfloat16",
|
38 |
+
"transformers_version": "4.39.3",
|
39 |
+
"tune_mm_mlp_adapter": false,
|
40 |
+
"unfreeze_mm_vision_tower": true,
|
41 |
+
"use_cache": true,
|
42 |
+
"use_mm_proj": true,
|
43 |
+
"use_sliding_window": false,
|
44 |
+
"vocab_size": 151936
|
45 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_sample": true,
|
3 |
+
"temperature": null,
|
4 |
+
"top_p": null,
|
5 |
+
"transformers_version": "4.39.3"
|
6 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3451e48823fc40570ceb5ec65f4ec42164de327e7301dbcb17e6a8311c36c583
|
3 |
+
size 3818688176
|
special_tokens_map.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
"<|im_start|>",
|
4 |
+
"<|im_end|>"
|
5 |
+
],
|
6 |
+
"eos_token": {
|
7 |
+
"content": "<|im_end|>",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": false,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false
|
12 |
+
},
|
13 |
+
"pad_token": {
|
14 |
+
"content": "<|endoftext|>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false
|
19 |
+
}
|
20 |
+
}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"151643": {
|
5 |
+
"content": "<|endoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"151644": {
|
13 |
+
"content": "<|im_start|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
},
|
20 |
+
"151645": {
|
21 |
+
"content": "<|im_end|>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false,
|
26 |
+
"special": true
|
27 |
+
}
|
28 |
+
},
|
29 |
+
"additional_special_tokens": [
|
30 |
+
"<|im_start|>",
|
31 |
+
"<|im_end|>"
|
32 |
+
],
|
33 |
+
"bos_token": null,
|
34 |
+
"chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
35 |
+
"clean_up_tokenization_spaces": false,
|
36 |
+
"eos_token": "<|im_end|>",
|
37 |
+
"errors": "replace",
|
38 |
+
"model_max_length": 8192,
|
39 |
+
"pad_token": "<|endoftext|>",
|
40 |
+
"padding_side": "right",
|
41 |
+
"split_special_tokens": false,
|
42 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
43 |
+
"unk_token": null
|
44 |
+
}
|
trainer_state.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d361fb06346d2a2a3d23f045bb097149bda736a9cec2c1ad4f666f6ce70e942
|
3 |
+
size 6584
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|