Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +235 -0
- added_tokens.json +24 -0
- chat_template.jinja +7 -0
- config.json +61 -0
- generation_config.json +10 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- preprocessor_config.json +39 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +208 -0
- video_preprocessor_config.json +43 -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
|
README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
inference: true
|
| 5 |
+
widget:
|
| 6 |
+
- text: Hello!
|
| 7 |
+
example_title: Hello world
|
| 8 |
+
group: Python
|
| 9 |
+
base_model:
|
| 10 |
+
- lmms-lab/LLaVA-OneVision-1.5-8B-Instruct
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [lmms-lab/LLaVA-OneVision-1.5-8B-Instruct](https://huggingface.co/lmms-lab/LLaVA-OneVision-1.5-8B-Instruct).
|
| 14 |
+
|
| 15 |
+
### Example usage:
|
| 16 |
+
|
| 17 |
+
```python
|
| 18 |
+
from transformers import AutoTokenizer, AutoProcessor, AutoModelForCausalLM
|
| 19 |
+
from qwen_vl_utils import process_vision_info
|
| 20 |
+
import torch
|
| 21 |
+
|
| 22 |
+
# fix flash_attn_varlen_func, see https://github.com/EvolvingLMMs-Lab/LLaVA-OneVision-1.5/pull/33/files
|
| 23 |
+
from flash_attn.flash_attn_interface import flash_attn_varlen_func
|
| 24 |
+
import transformers
|
| 25 |
+
transformers.modeling_flash_attention_utils.flash_attn_varlen_func = flash_attn_varlen_func
|
| 26 |
+
|
| 27 |
+
model_id = "tiny-random/llava-onevision-1.5"
|
| 28 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 29 |
+
model_id, dtype=torch.bfloat16, device_map="cuda", trust_remote_code=True
|
| 30 |
+
)
|
| 31 |
+
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 32 |
+
|
| 33 |
+
messages = [
|
| 34 |
+
{
|
| 35 |
+
"role": "user",
|
| 36 |
+
"content": [
|
| 37 |
+
{
|
| 38 |
+
"type": "image",
|
| 39 |
+
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
|
| 40 |
+
},
|
| 41 |
+
{"type": "text", "text": "Describe this image."},
|
| 42 |
+
],
|
| 43 |
+
}
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
# Preparation for inference
|
| 47 |
+
text = processor.apply_chat_template(
|
| 48 |
+
messages, tokenize=False, add_generation_prompt=True
|
| 49 |
+
)
|
| 50 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
| 51 |
+
inputs = processor(
|
| 52 |
+
text=[text],
|
| 53 |
+
images=image_inputs,
|
| 54 |
+
videos=video_inputs,
|
| 55 |
+
padding=True,
|
| 56 |
+
return_tensors="pt",
|
| 57 |
+
)
|
| 58 |
+
inputs = inputs.to("cuda")
|
| 59 |
+
|
| 60 |
+
# Inference: Generation of the output
|
| 61 |
+
generated_ids = model.generate(**inputs, max_new_tokens=32)
|
| 62 |
+
generated_ids_trimmed = [
|
| 63 |
+
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 64 |
+
]
|
| 65 |
+
output_text = processor.batch_decode(
|
| 66 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 67 |
+
)
|
| 68 |
+
print(output_text)
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
### Codes to create this repo:
|
| 72 |
+
|
| 73 |
+
```python
|
| 74 |
+
import json
|
| 75 |
+
from pathlib import Path
|
| 76 |
+
|
| 77 |
+
import accelerate
|
| 78 |
+
import torch
|
| 79 |
+
from huggingface_hub import file_exists, hf_hub_download
|
| 80 |
+
from transformers import (
|
| 81 |
+
AutoConfig,
|
| 82 |
+
AutoModelForCausalLM,
|
| 83 |
+
AutoProcessor,
|
| 84 |
+
GenerationConfig,
|
| 85 |
+
AutoModelForImageTextToText,
|
| 86 |
+
set_seed,
|
| 87 |
+
)
|
| 88 |
+
# fix flash_attn_varlen_func, see https://github.com/EvolvingLMMs-Lab/LLaVA-OneVision-1.5/pull/33/files
|
| 89 |
+
from flash_attn.flash_attn_interface import flash_attn_varlen_func
|
| 90 |
+
import transformers
|
| 91 |
+
transformers.modeling_flash_attention_utils.flash_attn_varlen_func = flash_attn_varlen_func
|
| 92 |
+
|
| 93 |
+
source_model_id = "lmms-lab/LLaVA-OneVision-1.5-8B-Instruct"
|
| 94 |
+
save_folder = "/tmp/tiny-random/llava-onevision-1.5"
|
| 95 |
+
|
| 96 |
+
processor = AutoProcessor.from_pretrained(source_model_id, trust_remote_code=True)
|
| 97 |
+
processor.save_pretrained(save_folder)
|
| 98 |
+
|
| 99 |
+
with open(hf_hub_download(source_model_id, filename='config.json', repo_type='model'), 'r', encoding='utf-8') as f:
|
| 100 |
+
config_json = json.load(f)
|
| 101 |
+
for k, v in config_json['auto_map'].items():
|
| 102 |
+
config_json['auto_map'][k] = f'{source_model_id}--{v}'
|
| 103 |
+
|
| 104 |
+
config_json['text_config'].update({
|
| 105 |
+
'head_dim': 32,
|
| 106 |
+
'hidden_size': 8,
|
| 107 |
+
'intermediate_size': 64,
|
| 108 |
+
'num_hidden_layers': 2,
|
| 109 |
+
'num_attention_heads': 8,
|
| 110 |
+
'num_key_value_heads': 4,
|
| 111 |
+
'layer_types': ['full_attention'] * 2,
|
| 112 |
+
'max_window_layers': 2,
|
| 113 |
+
})
|
| 114 |
+
config_json['vision_config'].update(
|
| 115 |
+
{
|
| 116 |
+
'depth': 2,
|
| 117 |
+
'intermediate_size': 256,
|
| 118 |
+
'embed_dim': 32 * 4,
|
| 119 |
+
'hidden_size': 32 * 4,
|
| 120 |
+
'text_hidden_size': 8,
|
| 121 |
+
'num_heads': 4,
|
| 122 |
+
'num_hidden_layers': 2,
|
| 123 |
+
}
|
| 124 |
+
)
|
| 125 |
+
with open(f"{save_folder}/config.json", "w", encoding='utf-8') as f:
|
| 126 |
+
json.dump(config_json, f, indent=2)
|
| 127 |
+
|
| 128 |
+
config = AutoConfig.from_pretrained(
|
| 129 |
+
save_folder,
|
| 130 |
+
trust_remote_code=True,
|
| 131 |
+
)
|
| 132 |
+
print(config)
|
| 133 |
+
torch.set_default_dtype(torch.bfloat16)
|
| 134 |
+
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True).to(torch.bfloat16)
|
| 135 |
+
torch.set_default_dtype(torch.float32)
|
| 136 |
+
if file_exists(filename="generation_config.json", repo_id=source_model_id, repo_type='model'):
|
| 137 |
+
model.generation_config = GenerationConfig.from_pretrained(
|
| 138 |
+
source_model_id, trust_remote_code=True,
|
| 139 |
+
)
|
| 140 |
+
model.generation_config.do_sample = True
|
| 141 |
+
print(model.generation_config)
|
| 142 |
+
model = model.cpu()
|
| 143 |
+
with torch.no_grad():
|
| 144 |
+
for name, p in sorted(model.named_parameters()):
|
| 145 |
+
torch.nn.init.normal_(p, 0, 0.1)
|
| 146 |
+
print(name, p.shape)
|
| 147 |
+
model.save_pretrained(save_folder)
|
| 148 |
+
|
| 149 |
+
def modify_automap(path, source_model_id):
|
| 150 |
+
import json
|
| 151 |
+
with open(path, 'r', encoding='utf-8') as f:
|
| 152 |
+
content = json.load(f)
|
| 153 |
+
automap = {}
|
| 154 |
+
if content.get('auto_map', None) is not None:
|
| 155 |
+
for key, value in content.get('auto_map').items():
|
| 156 |
+
if isinstance(value, str):
|
| 157 |
+
value = source_model_id + '--' + value.split('--')[-1]
|
| 158 |
+
else:
|
| 159 |
+
value = [(source_model_id + '--' + v.split('--')[-1]) if '.' in str(v) else v for v in value]
|
| 160 |
+
automap[key] = value
|
| 161 |
+
with open(path, 'w', encoding='utf-8') as f:
|
| 162 |
+
json.dump({**content, 'auto_map': automap}, f, indent=2)
|
| 163 |
+
|
| 164 |
+
modify_automap(f"{save_folder}/config.json", source_model_id)
|
| 165 |
+
# modify_automap(f'{save_folder}/processor_config.json', source_model_id)
|
| 166 |
+
# modify_automap(f'{save_folder}/preprocessor_config.json', source_model_id)
|
| 167 |
+
# modify_automap(f'{save_folder}/tokenizer_config.json', source_model_id)
|
| 168 |
+
for python_file in Path(save_folder).glob('*.py'):
|
| 169 |
+
python_file.unlink()
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
### Printing the model:
|
| 173 |
+
|
| 174 |
+
```text
|
| 175 |
+
LLaVAOneVision1_5_ForConditionalGeneration(
|
| 176 |
+
(model): LLaVAOneVision1_5_Model(
|
| 177 |
+
(visual): RiceTransformerPretrainedModel(
|
| 178 |
+
(patch_embed): RicePatchEmbed(
|
| 179 |
+
(proj): Conv2d(3, 128, kernel_size=(14, 14), stride=(14, 14), bias=False)
|
| 180 |
+
)
|
| 181 |
+
(rotary_pos_emb): RiceRotaryEmbedding()
|
| 182 |
+
(pre_layernorm): LayerNorm((128,), eps=1e-05, elementwise_affine=True)
|
| 183 |
+
(blocks): ModuleList(
|
| 184 |
+
(0-1): 2 x RiceBlock(
|
| 185 |
+
(norm1): LayerNorm((128,), eps=1e-05, elementwise_affine=True)
|
| 186 |
+
(norm2): LayerNorm((128,), eps=1e-05, elementwise_affine=True)
|
| 187 |
+
(attn): RiceSdpaAttention(
|
| 188 |
+
(qkv): Linear(in_features=128, out_features=384, bias=True)
|
| 189 |
+
(proj): Linear(in_features=128, out_features=128, bias=True)
|
| 190 |
+
)
|
| 191 |
+
(mlp): RiceMlp(
|
| 192 |
+
(fc1): Linear(in_features=128, out_features=256, bias=True)
|
| 193 |
+
(act): GELUActivation()
|
| 194 |
+
(fc2): Linear(in_features=256, out_features=128, bias=True)
|
| 195 |
+
)
|
| 196 |
+
)
|
| 197 |
+
)
|
| 198 |
+
(merger): RicePatchMerger(
|
| 199 |
+
(ln_q): LayerNorm((128,), eps=1e-05, elementwise_affine=True)
|
| 200 |
+
(mlp): Sequential(
|
| 201 |
+
(0): Linear(in_features=512, out_features=512, bias=True)
|
| 202 |
+
(1): GELU(approximate='none')
|
| 203 |
+
(2): Linear(in_features=512, out_features=8, bias=True)
|
| 204 |
+
)
|
| 205 |
+
)
|
| 206 |
+
)
|
| 207 |
+
(language_model): LLaVAOneVision1_5_TextModel(
|
| 208 |
+
(embed_tokens): Embedding(151936, 8)
|
| 209 |
+
(layers): ModuleList(
|
| 210 |
+
(0-1): 2 x LLaVAOneVision1_5_DecoderLayer(
|
| 211 |
+
(self_attn): LLaVAOneVision1_5_SdpaAttention(
|
| 212 |
+
(q_proj): Linear(in_features=8, out_features=256, bias=False)
|
| 213 |
+
(k_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 214 |
+
(v_proj): Linear(in_features=8, out_features=128, bias=False)
|
| 215 |
+
(o_proj): Linear(in_features=256, out_features=8, bias=False)
|
| 216 |
+
(q_norm): LLaVAOneVision1_5_RMSNorm((32,), eps=1e-06)
|
| 217 |
+
(k_norm): LLaVAOneVision1_5_RMSNorm((32,), eps=1e-06)
|
| 218 |
+
)
|
| 219 |
+
(mlp): LLaVAOneVision1_5_MLP(
|
| 220 |
+
(gate_proj): Linear(in_features=8, out_features=64, bias=False)
|
| 221 |
+
(up_proj): Linear(in_features=8, out_features=64, bias=False)
|
| 222 |
+
(down_proj): Linear(in_features=64, out_features=8, bias=False)
|
| 223 |
+
(act_fn): SiLU()
|
| 224 |
+
)
|
| 225 |
+
(input_layernorm): LLaVAOneVision1_5_RMSNorm((8,), eps=1e-06)
|
| 226 |
+
(post_attention_layernorm): LLaVAOneVision1_5_RMSNorm((8,), eps=1e-06)
|
| 227 |
+
)
|
| 228 |
+
)
|
| 229 |
+
(norm): LLaVAOneVision1_5_RMSNorm((8,), eps=1e-06)
|
| 230 |
+
(rotary_emb): LLaVAOneVision1_5_RotaryEmbedding()
|
| 231 |
+
)
|
| 232 |
+
)
|
| 233 |
+
(lm_head): Linear(in_features=8, out_features=151936, bias=False)
|
| 234 |
+
)
|
| 235 |
+
```
|
added_tokens.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</tool_call>": 151658,
|
| 3 |
+
"<tool_call>": 151657,
|
| 4 |
+
"<|box_end|>": 151649,
|
| 5 |
+
"<|box_start|>": 151648,
|
| 6 |
+
"<|endoftext|>": 151643,
|
| 7 |
+
"<|file_sep|>": 151664,
|
| 8 |
+
"<|fim_middle|>": 151660,
|
| 9 |
+
"<|fim_pad|>": 151662,
|
| 10 |
+
"<|fim_prefix|>": 151659,
|
| 11 |
+
"<|fim_suffix|>": 151661,
|
| 12 |
+
"<|im_end|>": 151645,
|
| 13 |
+
"<|im_start|>": 151644,
|
| 14 |
+
"<|image_pad|>": 151655,
|
| 15 |
+
"<|object_ref_end|>": 151647,
|
| 16 |
+
"<|object_ref_start|>": 151646,
|
| 17 |
+
"<|quad_end|>": 151651,
|
| 18 |
+
"<|quad_start|>": 151650,
|
| 19 |
+
"<|repo_name|>": 151663,
|
| 20 |
+
"<|video_pad|>": 151656,
|
| 21 |
+
"<|vision_end|>": 151653,
|
| 22 |
+
"<|vision_pad|>": 151654,
|
| 23 |
+
"<|vision_start|>": 151652
|
| 24 |
+
}
|
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 %}
|
config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LLaVAOneVision1_5_ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoConfig": "lmms-lab/LLaVA-OneVision-1.5-8B-Instruct--configuration_llavaonevision1_5.Llavaonevision1_5Config",
|
| 7 |
+
"AutoModel": "lmms-lab/LLaVA-OneVision-1.5-8B-Instruct--modeling_llavaonevision1_5.LLaVAOneVision1_5_ForConditionalGeneration",
|
| 8 |
+
"AutoModelForCausalLM": "lmms-lab/LLaVA-OneVision-1.5-8B-Instruct--modeling_llavaonevision1_5.LLaVAOneVision1_5_ForConditionalGeneration"
|
| 9 |
+
},
|
| 10 |
+
"dtype": "bfloat16",
|
| 11 |
+
"image_token_id": 151655,
|
| 12 |
+
"model_type": "llavaonevision1_5",
|
| 13 |
+
"text_config": {
|
| 14 |
+
"attention_bias": false,
|
| 15 |
+
"attention_dropout": 0.0,
|
| 16 |
+
"head_dim": 32,
|
| 17 |
+
"hidden_act": "silu",
|
| 18 |
+
"hidden_size": 8,
|
| 19 |
+
"image_token_id": null,
|
| 20 |
+
"initializer_range": 0.02,
|
| 21 |
+
"intermediate_size": 64,
|
| 22 |
+
"layer_types": [
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention"
|
| 25 |
+
],
|
| 26 |
+
"max_position_embeddings": 32768,
|
| 27 |
+
"max_window_layers": 2,
|
| 28 |
+
"model_type": "LLaVAOneVision1_5_text",
|
| 29 |
+
"num_attention_heads": 8,
|
| 30 |
+
"num_hidden_layers": 2,
|
| 31 |
+
"num_key_value_heads": 4,
|
| 32 |
+
"rms_norm_eps": 1e-06,
|
| 33 |
+
"rope_scaling": null,
|
| 34 |
+
"rope_theta": 1000000.0,
|
| 35 |
+
"sliding_window": null,
|
| 36 |
+
"use_cache": true,
|
| 37 |
+
"use_sliding_window": false,
|
| 38 |
+
"video_token_id": null,
|
| 39 |
+
"vocab_size": 151936
|
| 40 |
+
},
|
| 41 |
+
"transformers_version": "4.57.0.dev0",
|
| 42 |
+
"video_token_id": 151656,
|
| 43 |
+
"vision_config": {
|
| 44 |
+
"depth": 2,
|
| 45 |
+
"embed_dim": 128,
|
| 46 |
+
"hidden_act": "gelu",
|
| 47 |
+
"hidden_size": 128,
|
| 48 |
+
"in_channels": 3,
|
| 49 |
+
"initializer_range": 0.02,
|
| 50 |
+
"intermediate_size": 256,
|
| 51 |
+
"layer_norm_eps": 1e-05,
|
| 52 |
+
"model_type": "rice_vit",
|
| 53 |
+
"num_heads": 4,
|
| 54 |
+
"num_hidden_layers": 2,
|
| 55 |
+
"patch_size": 14,
|
| 56 |
+
"spatial_merge_size": 2,
|
| 57 |
+
"temporal_patch_size": 1,
|
| 58 |
+
"text_hidden_size": 8
|
| 59 |
+
},
|
| 60 |
+
"vocab_size": 151936
|
| 61 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 151643,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 151645,
|
| 6 |
+
"pad_token_id": 151643,
|
| 7 |
+
"repetition_penalty": 1.05,
|
| 8 |
+
"temperature": 1e-06,
|
| 9 |
+
"transformers_version": "4.57.0.dev0"
|
| 10 |
+
}
|
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:ed4632ff8b43894a59833aa331b6a02aacc89b83b53dd3db0a0906f4414d6313
|
| 3 |
+
size 6114256
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": null,
|
| 3 |
+
"data_format": "channels_first",
|
| 4 |
+
"default_to_square": true,
|
| 5 |
+
"device": null,
|
| 6 |
+
"disable_grouping": null,
|
| 7 |
+
"do_center_crop": null,
|
| 8 |
+
"do_convert_rgb": true,
|
| 9 |
+
"do_normalize": true,
|
| 10 |
+
"do_pad": null,
|
| 11 |
+
"do_rescale": true,
|
| 12 |
+
"do_resize": true,
|
| 13 |
+
"image_mean": [
|
| 14 |
+
0.48145466,
|
| 15 |
+
0.4578275,
|
| 16 |
+
0.40821073
|
| 17 |
+
],
|
| 18 |
+
"image_processor_type": "Qwen2VLImageProcessorFast",
|
| 19 |
+
"image_std": [
|
| 20 |
+
0.26862954,
|
| 21 |
+
0.26130258,
|
| 22 |
+
0.27577711
|
| 23 |
+
],
|
| 24 |
+
"input_data_format": null,
|
| 25 |
+
"max_pixels": 3240000,
|
| 26 |
+
"merge_size": 2,
|
| 27 |
+
"min_pixels": 3136,
|
| 28 |
+
"pad_size": null,
|
| 29 |
+
"patch_size": 14,
|
| 30 |
+
"processor_class": "Qwen2_5_VLProcessor",
|
| 31 |
+
"resample": 3,
|
| 32 |
+
"rescale_factor": 0.00392156862745098,
|
| 33 |
+
"return_tensors": null,
|
| 34 |
+
"size": {
|
| 35 |
+
"longest_edge": 3240000,
|
| 36 |
+
"shortest_edge": 3136
|
| 37 |
+
},
|
| 38 |
+
"temporal_patch_size": 1
|
| 39 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
|
| 3 |
+
size 11421896
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
}
|
| 181 |
+
},
|
| 182 |
+
"additional_special_tokens": [
|
| 183 |
+
"<|im_start|>",
|
| 184 |
+
"<|im_end|>",
|
| 185 |
+
"<|object_ref_start|>",
|
| 186 |
+
"<|object_ref_end|>",
|
| 187 |
+
"<|box_start|>",
|
| 188 |
+
"<|box_end|>",
|
| 189 |
+
"<|quad_start|>",
|
| 190 |
+
"<|quad_end|>",
|
| 191 |
+
"<|vision_start|>",
|
| 192 |
+
"<|vision_end|>",
|
| 193 |
+
"<|vision_pad|>",
|
| 194 |
+
"<|image_pad|>",
|
| 195 |
+
"<|video_pad|>"
|
| 196 |
+
],
|
| 197 |
+
"bos_token": null,
|
| 198 |
+
"clean_up_tokenization_spaces": false,
|
| 199 |
+
"eos_token": "<|im_end|>",
|
| 200 |
+
"errors": "replace",
|
| 201 |
+
"extra_special_tokens": {},
|
| 202 |
+
"model_max_length": 131072,
|
| 203 |
+
"pad_token": "<|endoftext|>",
|
| 204 |
+
"processor_class": "Qwen2_5_VLProcessor",
|
| 205 |
+
"split_special_tokens": false,
|
| 206 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 207 |
+
"unk_token": null
|
| 208 |
+
}
|
video_preprocessor_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": null,
|
| 3 |
+
"data_format": "channels_first",
|
| 4 |
+
"default_to_square": true,
|
| 5 |
+
"device": null,
|
| 6 |
+
"do_center_crop": null,
|
| 7 |
+
"do_convert_rgb": true,
|
| 8 |
+
"do_normalize": true,
|
| 9 |
+
"do_rescale": true,
|
| 10 |
+
"do_resize": true,
|
| 11 |
+
"do_sample_frames": false,
|
| 12 |
+
"fps": null,
|
| 13 |
+
"image_mean": [
|
| 14 |
+
0.48145466,
|
| 15 |
+
0.4578275,
|
| 16 |
+
0.40821073
|
| 17 |
+
],
|
| 18 |
+
"image_std": [
|
| 19 |
+
0.26862954,
|
| 20 |
+
0.26130258,
|
| 21 |
+
0.27577711
|
| 22 |
+
],
|
| 23 |
+
"input_data_format": null,
|
| 24 |
+
"max_frames": 768,
|
| 25 |
+
"max_pixels": 3240000,
|
| 26 |
+
"merge_size": 2,
|
| 27 |
+
"min_frames": 4,
|
| 28 |
+
"min_pixels": 3136,
|
| 29 |
+
"num_frames": null,
|
| 30 |
+
"pad_size": null,
|
| 31 |
+
"patch_size": 14,
|
| 32 |
+
"processor_class": "Qwen2_5_VLProcessor",
|
| 33 |
+
"resample": 3,
|
| 34 |
+
"rescale_factor": 0.00392156862745098,
|
| 35 |
+
"return_metadata": false,
|
| 36 |
+
"size": {
|
| 37 |
+
"longest_edge": 3240000,
|
| 38 |
+
"shortest_edge": 3136
|
| 39 |
+
},
|
| 40 |
+
"temporal_patch_size": 1,
|
| 41 |
+
"video_metadata": null,
|
| 42 |
+
"video_processor_type": "Qwen2VLVideoProcessor"
|
| 43 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|