初始化项目,由ModelHub XC社区提供模型

Model: HuggingFaceTB/SmolVLM-256M-Instruct
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-06-05 22:14:12 +08:00
commit 07d60d143e
39 changed files with 297108 additions and 0 deletions

35
.gitattributes vendored Normal file
View File

@@ -0,0 +1,35 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

316
README.md Normal file
View File

@@ -0,0 +1,316 @@
---
library_name: transformers
license: apache-2.0
datasets:
- HuggingFaceM4/the_cauldron
- HuggingFaceM4/Docmatix
pipeline_tag: image-text-to-text
language:
- en
base_model:
- HuggingFaceTB/SmolLM2-135M-Instruct
- google/siglip-base-patch16-512
---
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/SmolVLM_256_banner.png" width="800" height="auto" alt="Image description">
# SmolVLM-256M
SmolVLM-256M is the smallest multimodal model in the world. It accepts arbitrary sequences of image and text inputs to produce text outputs. It's designed for efficiency. SmolVLM can answer questions about images, describe visual content, or transcribe text. Its lightweight architecture makes it suitable for on-device applications while maintaining strong performance on multimodal tasks. It can run inference on one image with under 1GB of GPU RAM.
## Model Summary
- **Developed by:** Hugging Face 🤗
- **Model type:** Multi-modal model (image+text)
- **Language(s) (NLP):** English
- **License:** Apache 2.0
- **Architecture:** Based on [Idefics3](https://huggingface.co/HuggingFaceM4/Idefics3-8B-Llama3) (see technical summary)
## Resources
- **Demo:** [SmolVLM-256 Demo](https://huggingface.co/spaces/HuggingFaceTB/SmolVLM-256M-Demo)
- **Blog:** [Blog post](https://huggingface.co/blog/smolvlm)
## Uses
SmolVLM can be used for inference on multimodal (image + text) tasks where the input comprises text queries along with one or more images. Text and images can be interleaved arbitrarily, enabling tasks like image captioning, visual question answering, and storytelling based on visual content. The model does not support image generation.
To fine-tune SmolVLM on a specific task, you can follow [the fine-tuning tutorial](https://github.com/huggingface/smollm/blob/main/vision/finetuning/Smol_VLM_FT.ipynb).
### Technical Summary
SmolVLM leverages the lightweight SmolLM2 language model to provide a compact yet powerful multimodal experience. It introduces several changes compared to the larger SmolVLM 2.2B model:
- **Image compression:** We introduce a more radical image compression compared to Idefics3 and SmolVLM-2.2B to enable the model to infer faster and use less RAM.
- **Visual Token Encoding:** SmolVLM-256 uses 64 visual tokens to encode image patches of size 512×512. Larger images are divided into patches, each encoded separately, enhancing efficiency without compromising performance.
- **New special tokens:** We added new special tokens to divide the subimages. This allows for more efficient tokenization of the images.
- **Smoller vision encoder:** We went from a 400M parameter siglip vision encoder to a much smaller 93M encoder.
- **Larger image patches:** We are now passing patches of 512x512 to the vision encoder, instead of 384x384 like the larger SmolVLM. This allows the information to be encoded more efficiently.
More details about the training and architecture are available in our technical report.
### How to get started
You can use transformers to load, infer and fine-tune SmolVLM.
```python
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForVision2Seq
from transformers.image_utils import load_image
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
# Load images
image = load_image("https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg")
# Initialize processor and model
processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM-256M-Instruct")
model = AutoModelForVision2Seq.from_pretrained(
"HuggingFaceTB/SmolVLM-256M-Instruct",
torch_dtype=torch.bfloat16,
_attn_implementation="flash_attention_2" if DEVICE == "cuda" else "eager",
).to(DEVICE)
# Create input messages
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Can you describe this image?"}
]
},
]
# Prepare inputs
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
inputs = processor(text=prompt, images=[image], return_tensors="pt")
inputs = inputs.to(DEVICE)
# Generate outputs
generated_ids = model.generate(**inputs, max_new_tokens=500)
generated_texts = processor.batch_decode(
generated_ids,
skip_special_tokens=True,
)
print(generated_texts[0])
"""
Assistant: The image depicts a large, historic statue of liberty, located in New York City. The statue is a green, cylindrical structure with a human figure at the top, holding a torch. The statue is situated on a pedestal that resembles the statue of liberty, which is located on a small island in the middle of a body of water. The water surrounding the island is calm, reflecting the blue sky and the statue.
In the background, there are several tall buildings, including the Empire State Building, which is visible in the distance. These buildings are made of glass and steel, and they are positioned in a grid-like pattern, giving them a modern look. The sky is clear, with a few clouds visible, indicating fair weather.
The statue is surrounded by trees, which are green and appear to be healthy. There are also some small structures, possibly houses or buildings, visible in the distance. The overall scene suggests a peaceful and serene environment, typical of a cityscape.
The image is taken during the daytime, likely during the day of the statue's installation. The lighting is bright, casting a strong shadow on the statue and the water, which enhances the visibility of the statue and the surrounding environment.
To summarize, the image captures a significant historical statue of liberty, situated on a small island in the middle of a body of water, surrounded by trees and buildings. The sky is clear, with a few clouds visible, indicating fair weather. The statue is green and cylindrical, with a human figure holding a torch, and is surrounded by trees, indicating a peaceful and well-maintained environment. The overall scene is one of tranquility and historical significance.
"""
```
We also provide ONNX weights for the model, which you can run with ONNX Runtime as follows:
<details>
<summary>Click here to see the sample code</summary>
```python
from transformers import AutoConfig, AutoProcessor
from transformers.image_utils import load_image
import onnxruntime
import numpy as np
# 1. Load models
## Load config and processor
model_id = "HuggingFaceTB/SmolVLM-256M-Instruct"
config = AutoConfig.from_pretrained(model_id)
processor = AutoProcessor.from_pretrained(model_id)
## Load sessions
## !wget https://huggingface.co/HuggingFaceTB/SmolVLM-256M-Instruct/resolve/main/onnx/vision_encoder.onnx
## !wget https://huggingface.co/HuggingFaceTB/SmolVLM-256M-Instruct/resolve/main/onnx/embed_tokens.onnx
## !wget https://huggingface.co/HuggingFaceTB/SmolVLM-256M-Instruct/resolve/main/onnx/decoder_model_merged.onnx
vision_session = onnxruntime.InferenceSession("vision_encoder.onnx")
embed_session = onnxruntime.InferenceSession("embed_tokens.onnx")
decoder_session = onnxruntime.InferenceSession("decoder_model_merged.onnx")
## Set config values
num_key_value_heads = config.text_config.num_key_value_heads
head_dim = config.text_config.head_dim
num_hidden_layers = config.text_config.num_hidden_layers
eos_token_id = config.text_config.eos_token_id
image_token_id = config.image_token_id
# 2. Prepare inputs
## Create input messages
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Can you describe this image?"}
]
},
]
## Load image and apply processor
image = load_image("https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg")
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
inputs = processor(text=prompt, images=[image], return_tensors="np")
## Prepare decoder inputs
batch_size = inputs['input_ids'].shape[0]
past_key_values = {
f'past_key_values.{layer}.{kv}': np.zeros([batch_size, num_key_value_heads, 0, head_dim], dtype=np.float32)
for layer in range(num_hidden_layers)
for kv in ('key', 'value')
}
image_features = None
input_ids = inputs['input_ids']
attention_mask = inputs['attention_mask']
position_ids = np.cumsum(inputs['attention_mask'], axis=-1)
# 3. Generation loop
max_new_tokens = 1024
generated_tokens = np.array([[]], dtype=np.int64)
for i in range(max_new_tokens):
inputs_embeds = embed_session.run(None, {'input_ids': input_ids})[0]
if image_features is None:
## Only compute vision features if not already computed
image_features = vision_session.run(
['image_features'], # List of output names or indices
{
'pixel_values': inputs['pixel_values'],
'pixel_attention_mask': inputs['pixel_attention_mask'].astype(np.bool_)
}
)[0]
## Merge text and vision embeddings
inputs_embeds[inputs['input_ids'] == image_token_id] = image_features.reshape(-1, image_features.shape[-1])
logits, *present_key_values = decoder_session.run(None, dict(
inputs_embeds=inputs_embeds,
attention_mask=attention_mask,
position_ids=position_ids,
**past_key_values,
))
## Update values for next generation loop
input_ids = logits[:, -1].argmax(-1, keepdims=True)
attention_mask = np.ones_like(input_ids)
position_ids = position_ids[:, -1:] + 1
for j, key in enumerate(past_key_values):
past_key_values[key] = present_key_values[j]
generated_tokens = np.concatenate([generated_tokens, input_ids], axis=-1)
if (input_ids == eos_token_id).all():
break
## (Optional) Streaming
print(processor.decode(input_ids[0]), end='')
print()
# 4. Output result
print(processor.batch_decode(generated_tokens))
```
Example output:
```
The image depicts a large, historic statue of Liberty situated on a small island in a body of water. The statue is a green, cylindrical structure with a human figure at the top, which is the actual statue of Liberty. The statue is mounted on a pedestal that is supported by a cylindrical tower. The pedestal is rectangular and appears to be made of stone or a similar material. The statue is surrounded by a large, flat, rectangular area that is likely a base for the statue.
In the background, there is a cityscape with a variety of buildings, including skyscrapers and high-rise buildings. The sky is clear with a gradient of colors, transitioning from a pale blue at the top to a deeper blue at the bottom. The buildings are mostly modern, with a mix of glass and concrete. The buildings are densely packed, with many skyscrapers and high-rise buildings visible.
There are trees and greenery visible on the left side of the image, indicating that the statue is located near a park or a park area. The water in the foreground is calm, with small ripples indicating that the statue is in the water.
The overall scene suggests a peaceful and serene environment, likely a public park or a park area in a city. The statue is likely a representation of liberty, representing the city's commitment to freedom and democracy.
### Analysis and Description:
#### Statue of Liberty:
- **Location**: The statue is located on a small island in a body of water.
- **Statue**: The statue is a green cylindrical structure with a human figure at the top, which is the actual statue of Liberty.
- **Pedestal**: The pedestal is rectangular and supports the statue.
- **Pedestrian**: The pedestal is surrounded by a flat rectangular area.
- **Water**: The water is calm, with small ripples indicating that the statue is in the water.
#### Cityscape:
- **Buildings**: The buildings are modern, with a mix of glass and concrete.
- **Sky**: The sky is clear with a gradient of colors, transitioning from a pale blue at the top to a deeper blue at the bottom.
- **Trees**: There are trees and greenery visible on the left side of the image, indicating that the statue is located near a park or a park area.
#### Environment:
- **Water**: The water is calm, with small ripples indicating that the statue is in the water.
- **Sky**: The sky is clear with a gradient of colors, transitioning from a pale blue at the top to a deeper blue at the bottom.
### Conclusion:
The image depicts a peaceful and serene public park or park area in a city, with the statue of Liberty prominently featured. The cityscape in the background includes modern buildings and a clear sky, suggesting a well-maintained public space.<end_of_utterance>
```
</details>
### Model optimizations
**Precision**: For better performance, load and run the model in half-precision (`torch.bfloat16`) if your hardware supports it.
```python
from transformers import AutoModelForVision2Seq
import torch
model = AutoModelForVision2Seq.from_pretrained(
"HuggingFaceTB/SmolVLM-Instruct",
torch_dtype=torch.bfloat16
).to("cuda")
```
You can also load SmolVLM with 4/8-bit quantization using bitsandbytes, torchao or Quanto. Refer to [this page](https://huggingface.co/docs/transformers/en/main_classes/quantization) for other options.
```python
from transformers import AutoModelForVision2Seq, BitsAndBytesConfig
import torch
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
model = AutoModelForVision2Seq.from_pretrained(
"HuggingFaceTB/SmolVLM-Instruct",
quantization_config=quantization_config,
)
```
**Vision Encoder Efficiency**: Adjust the image resolution by setting `size={"longest_edge": N*512}` when initializing the processor, where N is your desired value. The default `N=4` works well, which results in input images of
size 2048×2048. Decreasing N can save GPU memory and is appropriate for lower-resolution images. This is also useful if you want to fine-tune on videos.
## Misuse and Out-of-scope Use
SmolVLM is not intended for high-stakes scenarios or critical decision-making processes that affect an individual's well-being or livelihood. The model may produce content that appears factual but may not be accurate. Misuse includes, but is not limited to:
- Prohibited Uses:
- Evaluating or scoring individuals (e.g., in employment, education, credit)
- Critical automated decision-making
- Generating unreliable factual content
- Malicious Activities:
- Spam generation
- Disinformation campaigns
- Harassment or abuse
- Unauthorized surveillance
### License
SmolVLM is built upon [SigLIP](https://huggingface.co/google/siglip-base-patch16-512) as image encoder and [SmolLM2](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) for text decoder part.
We release the SmolVLM checkpoints under the Apache 2.0 license.
## Training Details
### Training Data
The training data comes from [The Cauldron](https://huggingface.co/datasets/HuggingFaceM4/the_cauldron) and [Docmatix](https://huggingface.co/datasets/HuggingFaceM4/Docmatix) datasets, with emphasis on document understanding (25%) and image captioning (18%), while maintaining balanced coverage across other crucial capabilities like visual reasoning, chart comprehension, and general instruction following.
<img src="https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct/resolve/main/mixture_the_cauldron.png" alt="Example Image" style="width:90%;" />
## Evaluation
| Size | Mathvista | MMMU | OCRBench | MMStar | AI2D | ChartQA_Test | Science_QA | TextVQA Val | DocVQA Val |
|-------|-----------|------|----------|--------|-------|--------------|------------|-------------|------------|
| 256M | 35.9 | 28.3 | 52.6 | 34.6 | 47 | 55.8 | 73.6 | 49.9 | 58.3 |
| 500M | 40.1 | 33.7 | 61 | 38.3 | 59.5 | 63.2 | 79.7 | 60.5 | 70.5 |
| 2.2B | 43.9 | 38.3 | 65.5 | 41.8 | 64 | 71.6 | 84.5 | 72.1 | 79.7 |

130
added_tokens.json Normal file
View File

@@ -0,0 +1,130 @@
{
"<end_of_utterance>": 49279,
"<fake_token_around_image>": 49189,
"<global-img>": 49152,
"<image>": 49190,
"<row_1_col_1>": 49153,
"<row_1_col_2>": 49154,
"<row_1_col_3>": 49155,
"<row_1_col_4>": 49156,
"<row_1_col_5>": 49157,
"<row_1_col_6>": 49158,
"<row_2_col_1>": 49159,
"<row_2_col_2>": 49160,
"<row_2_col_3>": 49161,
"<row_2_col_4>": 49162,
"<row_2_col_5>": 49163,
"<row_2_col_6>": 49164,
"<row_3_col_1>": 49165,
"<row_3_col_2>": 49166,
"<row_3_col_3>": 49167,
"<row_3_col_4>": 49168,
"<row_3_col_5>": 49169,
"<row_3_col_6>": 49170,
"<row_4_col_1>": 49171,
"<row_4_col_2>": 49172,
"<row_4_col_3>": 49173,
"<row_4_col_4>": 49174,
"<row_4_col_5>": 49175,
"<row_4_col_6>": 49176,
"<row_5_col_1>": 49177,
"<row_5_col_2>": 49178,
"<row_5_col_3>": 49179,
"<row_5_col_4>": 49180,
"<row_5_col_5>": 49181,
"<row_5_col_6>": 49182,
"<row_6_col_1>": 49183,
"<row_6_col_2>": 49184,
"<row_6_col_3>": 49185,
"<row_6_col_4>": 49186,
"<row_6_col_5>": 49187,
"<row_6_col_6>": 49188,
"<|reserved_special_token_0|>": 49191,
"<|reserved_special_token_10|>": 49201,
"<|reserved_special_token_11|>": 49202,
"<|reserved_special_token_12|>": 49203,
"<|reserved_special_token_13|>": 49204,
"<|reserved_special_token_14|>": 49205,
"<|reserved_special_token_15|>": 49206,
"<|reserved_special_token_16|>": 49207,
"<|reserved_special_token_17|>": 49208,
"<|reserved_special_token_18|>": 49209,
"<|reserved_special_token_19|>": 49210,
"<|reserved_special_token_1|>": 49192,
"<|reserved_special_token_20|>": 49211,
"<|reserved_special_token_21|>": 49212,
"<|reserved_special_token_22|>": 49213,
"<|reserved_special_token_23|>": 49214,
"<|reserved_special_token_24|>": 49215,
"<|reserved_special_token_25|>": 49216,
"<|reserved_special_token_26|>": 49217,
"<|reserved_special_token_27|>": 49218,
"<|reserved_special_token_28|>": 49219,
"<|reserved_special_token_29|>": 49220,
"<|reserved_special_token_2|>": 49193,
"<|reserved_special_token_30|>": 49221,
"<|reserved_special_token_31|>": 49222,
"<|reserved_special_token_32|>": 49223,
"<|reserved_special_token_33|>": 49224,
"<|reserved_special_token_34|>": 49225,
"<|reserved_special_token_35|>": 49226,
"<|reserved_special_token_36|>": 49227,
"<|reserved_special_token_37|>": 49228,
"<|reserved_special_token_38|>": 49229,
"<|reserved_special_token_39|>": 49230,
"<|reserved_special_token_3|>": 49194,
"<|reserved_special_token_40|>": 49231,
"<|reserved_special_token_41|>": 49232,
"<|reserved_special_token_42|>": 49233,
"<|reserved_special_token_43|>": 49234,
"<|reserved_special_token_44|>": 49235,
"<|reserved_special_token_45|>": 49236,
"<|reserved_special_token_46|>": 49237,
"<|reserved_special_token_47|>": 49238,
"<|reserved_special_token_48|>": 49239,
"<|reserved_special_token_49|>": 49240,
"<|reserved_special_token_4|>": 49195,
"<|reserved_special_token_50|>": 49241,
"<|reserved_special_token_51|>": 49242,
"<|reserved_special_token_52|>": 49243,
"<|reserved_special_token_53|>": 49244,
"<|reserved_special_token_54|>": 49245,
"<|reserved_special_token_55|>": 49246,
"<|reserved_special_token_56|>": 49247,
"<|reserved_special_token_57|>": 49248,
"<|reserved_special_token_58|>": 49249,
"<|reserved_special_token_59|>": 49250,
"<|reserved_special_token_5|>": 49196,
"<|reserved_special_token_60|>": 49251,
"<|reserved_special_token_61|>": 49252,
"<|reserved_special_token_62|>": 49253,
"<|reserved_special_token_63|>": 49254,
"<|reserved_special_token_64|>": 49255,
"<|reserved_special_token_65|>": 49256,
"<|reserved_special_token_66|>": 49257,
"<|reserved_special_token_67|>": 49258,
"<|reserved_special_token_68|>": 49259,
"<|reserved_special_token_69|>": 49260,
"<|reserved_special_token_6|>": 49197,
"<|reserved_special_token_70|>": 49261,
"<|reserved_special_token_71|>": 49262,
"<|reserved_special_token_72|>": 49263,
"<|reserved_special_token_73|>": 49264,
"<|reserved_special_token_74|>": 49265,
"<|reserved_special_token_75|>": 49266,
"<|reserved_special_token_76|>": 49267,
"<|reserved_special_token_77|>": 49268,
"<|reserved_special_token_78|>": 49269,
"<|reserved_special_token_79|>": 49270,
"<|reserved_special_token_7|>": 49198,
"<|reserved_special_token_80|>": 49271,
"<|reserved_special_token_81|>": 49272,
"<|reserved_special_token_82|>": 49273,
"<|reserved_special_token_83|>": 49274,
"<|reserved_special_token_84|>": 49275,
"<|reserved_special_token_85|>": 49276,
"<|reserved_special_token_86|>": 49277,
"<|reserved_special_token_87|>": 49278,
"<|reserved_special_token_8|>": 49199,
"<|reserved_special_token_9|>": 49200
}

3
chat_template.json Normal file
View File

@@ -0,0 +1,3 @@
{
"chat_template": "<|im_start|>{% for message in messages %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>\n{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}"
}

271
config.json Normal file
View File

@@ -0,0 +1,271 @@
{
"architectures": [
"Idefics3ForConditionalGeneration"
],
"image_token_id": 49190,
"model_type": "idefics3",
"scale_factor": 4,
"text_config": {
"_attn_implementation_autoset": false,
"_flash_attn_2_enabled": true,
"_name_or_path": "None",
"add_cross_attention": false,
"architectures": [
"VLlama3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bad_words_ids": null,
"begin_suppress_tokens": null,
"bos_token_id": 1,
"chunk_size_feed_forward": 0,
"cross_attention_hidden_size": null,
"decoder_start_token_id": null,
"diversity_penalty": 0.0,
"do_sample": false,
"early_stopping": false,
"encoder_no_repeat_ngram_size": 0,
"eos_token_id": 2,
"exponential_decay_length_penalty": null,
"finetuning_task": null,
"forced_bos_token_id": null,
"forced_eos_token_id": null,
"head_dim": 64,
"hidden_act": "silu",
"hidden_size": 576,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1"
},
"initializer_range": 0.041666666666666664,
"intermediate_size": 1536,
"is_decoder": false,
"is_encoder_decoder": false,
"is_llama_config": true,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1
},
"length_penalty": 1.0,
"max_length": 20,
"max_position_embeddings": 8192,
"min_length": 0,
"mlp_bias": false,
"model_type": "llama",
"neftune_noise_alpha": 0.0,
"no_repeat_ngram_size": 0,
"num_attention_heads": 9,
"num_beam_groups": 1,
"num_beams": 1,
"num_hidden_layers": 30,
"num_key_value_heads": 3,
"num_return_sequences": 1,
"output_attentions": false,
"output_hidden_states": false,
"output_scores": false,
"pad_token_id": 2,
"perceiver_config": {
"_attn_implementation_autoset": false,
"_name_or_path": "",
"add_cross_attention": false,
"architectures": null,
"attention_dropout": 0.0,
"bad_words_ids": null,
"begin_suppress_tokens": null,
"bos_token_id": null,
"chunk_size_feed_forward": 0,
"cross_attention_hidden_size": null,
"decoder_start_token_id": null,
"diversity_penalty": 0.0,
"do_sample": false,
"early_stopping": false,
"encoder_no_repeat_ngram_size": 0,
"eos_token_id": null,
"exponential_decay_length_penalty": null,
"finetuning_task": null,
"forced_bos_token_id": null,
"forced_eos_token_id": null,
"hidden_act": "silu",
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1"
},
"is_decoder": false,
"is_encoder_decoder": false,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1
},
"length_penalty": 1.0,
"max_length": 20,
"min_length": 0,
"model_type": "vllama3",
"no_repeat_ngram_size": 0,
"num_beam_groups": 1,
"num_beams": 1,
"num_key_value_heads": 1,
"num_return_sequences": 1,
"output_attentions": false,
"output_hidden_states": false,
"output_scores": false,
"pad_token_id": null,
"prefix": null,
"problem_type": null,
"pruned_heads": {},
"qk_layer_norms_perceiver": false,
"remove_invalid_values": false,
"repetition_penalty": 1.0,
"resampler_depth": 6,
"resampler_head_dim": 96,
"resampler_n_heads": 16,
"resampler_n_latents": 64,
"return_dict": true,
"return_dict_in_generate": false,
"sep_token_id": null,
"suppress_tokens": null,
"task_specific_params": null,
"temperature": 1.0,
"tf_legacy_loss": false,
"tie_encoder_decoder": false,
"tie_word_embeddings": true,
"tokenizer_class": null,
"top_k": 50,
"top_p": 1.0,
"torch_dtype": null,
"torchscript": false,
"transformers_version": "4.46.0",
"typical_p": 1.0,
"use_bfloat16": false
},
"pixel_shuffle_factor": 4,
"prefix": null,
"pretraining_tp": 1,
"problem_type": null,
"pruned_heads": {},
"qk_layer_norms": false,
"remove_invalid_values": false,
"repetition_penalty": 1.0,
"return_dict": true,
"return_dict_in_generate": false,
"rms_norm_eps": 1e-05,
"rope_interleaved": false,
"rope_scaling": null,
"rope_theta": 100000,
"sep_token_id": null,
"suppress_tokens": null,
"task_specific_params": null,
"temperature": 1.0,
"tf_legacy_loss": false,
"tie_encoder_decoder": false,
"tie_word_embeddings": false,
"tokenizer_class": null,
"top_k": 50,
"top_p": 1.0,
"torch_dtype": "bfloat16",
"torchscript": false,
"transformers.js_config": {
"kv_cache_dtype": {
"fp16": "float16",
"q4f16": "float16"
}
},
"typical_p": 1.0,
"use_bfloat16": false,
"use_cache": true,
"use_resampler": false,
"vocab_size": 49280
},
"tie_word_embeddings": false,
"torch_dtype": "bfloat16",
"transformers_version": "4.46.0",
"transformers.js_config": {
"kv_cache_dtype": {
"q4f16": "float16",
"fp16": "float16"
}
},
"use_cache": true,
"vision_config": {
"use_base_siglip": true,
"_attn_implementation_autoset": false,
"_name_or_path": "",
"add_cross_attention": false,
"architectures": null,
"attention_dropout": 0.0,
"bad_words_ids": null,
"begin_suppress_tokens": null,
"bos_token_id": null,
"chunk_size_feed_forward": 0,
"cross_attention_hidden_size": null,
"decoder_start_token_id": null,
"diversity_penalty": 0.0,
"do_sample": false,
"early_stopping": false,
"encoder_no_repeat_ngram_size": 0,
"eos_token_id": null,
"exponential_decay_length_penalty": null,
"finetuning_task": null,
"forced_bos_token_id": null,
"forced_eos_token_id": null,
"hidden_act": "gelu_pytorch_tanh",
"hidden_size": 768,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1"
},
"image_size": 512,
"initializer_range": 0.02,
"intermediate_size": 3072,
"is_decoder": false,
"is_encoder_decoder": false,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1
},
"layer_norm_eps": 1e-06,
"length_penalty": 1.0,
"max_image_size": {
"longest_edge": 512
},
"max_length": 20,
"min_length": 0,
"model_type": "idefics3",
"no_repeat_ngram_size": 0,
"num_attention_heads": 12,
"num_beam_groups": 1,
"num_beams": 1,
"num_channels": 3,
"num_hidden_layers": 12,
"num_return_sequences": 1,
"output_attentions": false,
"output_hidden_states": false,
"output_scores": false,
"pad_token_id": null,
"patch_size": 16,
"prefix": null,
"problem_type": null,
"pruned_heads": {},
"remove_invalid_values": false,
"repetition_penalty": 1.0,
"return_dict": true,
"return_dict_in_generate": false,
"sep_token_id": null,
"size": {
"longest_edge": 2048
},
"suppress_tokens": null,
"task_specific_params": null,
"temperature": 1.0,
"tf_legacy_loss": false,
"tie_encoder_decoder": false,
"tie_word_embeddings": false,
"tokenizer_class": null,
"top_k": 50,
"top_p": 1.0,
"torch_dtype": null,
"torchscript": false,
"typical_p": 1.0,
"use_bfloat16": false
},
"vocab_size": 49280
}

1
configuration.json Normal file
View File

@@ -0,0 +1 @@
{"framework": "pytorch", "task": "image-text-to-text", "allow_remote": true}

7
generation_config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 0,
"eos_token_id": 49279,
"pad_token_id": 2,
"transformers_version": "4.46.0"
}

48901
merges.txt Normal file

File diff suppressed because it is too large Load Diff

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:74dea5904032e5ae99a2e0eef5179e6ac0f1dedc3ab0c7c2a5d4d387c843203e
size 513028808

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2817946df1e3b4c99ad196995338edc1c1c0d8423d3b5153da77f67f8c2efc0a
size 540971996

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b8ba5c04aa524c2a3cdcba4825df38b24c04619ecffa6c6afcc77220f565bb3
size 78486591

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6bb75887b9f71b0f61cc1621dcc47c711f5b61fbf64a895500fe2e577f2929c2
size 270745856

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5580b6f2f49fa7c034cd67ba12196b11d5ab5162d7318baf48ead494e45944ca
size 137553014

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e8f67dd06edf4edbbfeca36f79aaa1b3ea934a2b166d462b3b152788ec3232cd
size 86894595

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b297c76610889394757b8baacda12ce27b23747afafd3ddf5b7fbb183f699704
size 77366233

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3d19fafe563a1277492b94a562eda7c5c01a27373b2ee4cb4e716713d261a93
size 137553128

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3d19fafe563a1277492b94a562eda7c5c01a27373b2ee4cb4e716713d261a93
size 137553128

3
onnx/embed_tokens.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a68ea4058524059ed0e2873fdbc4f33b93e13ae3d3204938d32d0566d390ae00
size 113541419

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47ed7029703cff586fd719d70251324766a6591c8a58d315076b1781a65fc900
size 113541438

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:019af59078b8e4775216dd278c66574c39bfefa36cab68573db64d7ac7a11691
size 56770946

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b919b829fe2bf225e42431230c56891116f0149e5170e36c99bcc0cfae0d2ef
size 28385824

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47ed7029703cff586fd719d70251324766a6591c8a58d315076b1781a65fc900
size 113541438

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d810e0849eda8128be2d9cf1a2be9ca0bd8e5bfbe5bf972f60ea8e2a566f6bfe
size 56770965

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b919b829fe2bf225e42431230c56891116f0149e5170e36c99bcc0cfae0d2ef
size 28385824

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b919b829fe2bf225e42431230c56891116f0149e5170e36c99bcc0cfae0d2ef
size 28385824

3
onnx/vision_encoder.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e27ad810eabfa7c881b409e1ca357e7a951541019add228ff73c72718fcf6218
size 374316497

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7d2b29e46fa0de326b63e92e751561cf28180d597ad0ad0859f92bf598944352
size 58034739

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:275c41d775508b7f7410580c4aaf67583a34acf23c31259effa8e53f67e8d9ae
size 187294693

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d534ab668d3563e6d1d809bbbf1ff18308ded48651178614dbcc4a1de13d16f7
size 94247927

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:95814e6629ec465e7cf98a44edcee67abc06d41faa0d1acc410cf8a956cab488
size 63784987

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:13c301dc0cbc79c8c23badc699129b47d05ba044e2274ca8a94681fcd4205fc1
size 55037584

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f82adc84246fbfe8651038470166385452682cc889538f5106544e622e5f1595
size 94247969

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f82adc84246fbfe8651038470166385452682cc889538f5106544e622e5f1595
size 94247969

28
preprocessor_config.json Normal file
View File

@@ -0,0 +1,28 @@
{
"do_convert_rgb": true,
"do_image_splitting": true,
"do_normalize": true,
"do_pad": true,
"do_rescale": true,
"do_resize": true,
"image_mean": [
0.5,
0.5,
0.5
],
"image_processor_type": "Idefics3ImageProcessor",
"image_std": [
0.5,
0.5,
0.5
],
"max_image_size": {
"longest_edge": 512
},
"processor_class": "Idefics3Processor",
"resample": 1,
"rescale_factor": 0.00392156862745098,
"size": {
"longest_edge": 2048
}
}

4
processor_config.json Normal file
View File

@@ -0,0 +1,4 @@
{
"image_seq_len": 64,
"processor_class": "Idefics3Processor"
}

53
special_tokens_map.json Normal file
View File

@@ -0,0 +1,53 @@
{
"additional_special_tokens": [
{
"content": "<fake_token_around_image>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
{
"content": "<image>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
{
"content": "<end_of_utterance>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
],
"bos_token": {
"content": "<|im_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|im_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": {
"content": "<|im_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"unk_token": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

246101
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

1182
tokenizer_config.json Normal file

File diff suppressed because it is too large Load Diff

1
vocab.json Normal file

File diff suppressed because one or more lines are too long