Image-Text-to-Text
Transformers
PyTorch
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL2_5-4B-MPO-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2_5-4B-MPO-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2_5-4B-MPO-AWQ", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL2_5-4B-MPO-AWQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/InternVL2_5-4B-MPO-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2_5-4B-MPO-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL2_5-4B-MPO-AWQ", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/OpenGVLab/InternVL2_5-4B-MPO-AWQ
- SGLang
How to use OpenGVLab/InternVL2_5-4B-MPO-AWQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenGVLab/InternVL2_5-4B-MPO-AWQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL2_5-4B-MPO-AWQ", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenGVLab/InternVL2_5-4B-MPO-AWQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL2_5-4B-MPO-AWQ", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use OpenGVLab/InternVL2_5-4B-MPO-AWQ with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2_5-4B-MPO-AWQ
Update README.md
Browse files- config.json +0 -55
config.json
CHANGED
|
@@ -110,91 +110,36 @@
|
|
| 110 |
"select_layer": -1,
|
| 111 |
"template": "internvl2_5",
|
| 112 |
"torch_dtype": "float16",
|
| 113 |
-
"transformers_version": null,
|
| 114 |
"use_backbone_lora": 0,
|
| 115 |
"use_llm_lora": 0,
|
| 116 |
"use_thumbnail": true,
|
| 117 |
"vision_config": {
|
| 118 |
-
"_name_or_path": "",
|
| 119 |
-
"add_cross_attention": false,
|
| 120 |
"architectures": [
|
| 121 |
"InternVisionModel"
|
| 122 |
],
|
| 123 |
"attention_dropout": 0.0,
|
| 124 |
-
"bad_words_ids": null,
|
| 125 |
-
"begin_suppress_tokens": null,
|
| 126 |
-
"bos_token_id": null,
|
| 127 |
-
"chunk_size_feed_forward": 0,
|
| 128 |
-
"cross_attention_hidden_size": null,
|
| 129 |
-
"decoder_start_token_id": null,
|
| 130 |
-
"diversity_penalty": 0.0,
|
| 131 |
-
"do_sample": false,
|
| 132 |
"drop_path_rate": 0.0,
|
| 133 |
"dropout": 0.0,
|
| 134 |
-
"early_stopping": false,
|
| 135 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 136 |
-
"eos_token_id": null,
|
| 137 |
-
"exponential_decay_length_penalty": null,
|
| 138 |
-
"finetuning_task": null,
|
| 139 |
-
"forced_bos_token_id": null,
|
| 140 |
-
"forced_eos_token_id": null,
|
| 141 |
"hidden_act": "gelu",
|
| 142 |
"hidden_size": 1024,
|
| 143 |
-
"id2label": {
|
| 144 |
-
"0": "LABEL_0",
|
| 145 |
-
"1": "LABEL_1"
|
| 146 |
-
},
|
| 147 |
"image_size": 448,
|
| 148 |
"initializer_factor": 1.0,
|
| 149 |
"initializer_range": 0.02,
|
| 150 |
"intermediate_size": 4096,
|
| 151 |
-
"is_decoder": false,
|
| 152 |
-
"is_encoder_decoder": false,
|
| 153 |
-
"label2id": {
|
| 154 |
-
"LABEL_0": 0,
|
| 155 |
-
"LABEL_1": 1
|
| 156 |
-
},
|
| 157 |
"layer_norm_eps": 1e-06,
|
| 158 |
-
"length_penalty": 1.0,
|
| 159 |
-
"max_length": 20,
|
| 160 |
-
"min_length": 0,
|
| 161 |
"model_type": "intern_vit_6b",
|
| 162 |
-
"no_repeat_ngram_size": 0,
|
| 163 |
"norm_type": "layer_norm",
|
| 164 |
"num_attention_heads": 16,
|
| 165 |
-
"num_beam_groups": 1,
|
| 166 |
-
"num_beams": 1,
|
| 167 |
"num_channels": 3,
|
| 168 |
"num_hidden_layers": 24,
|
| 169 |
-
"num_return_sequences": 1,
|
| 170 |
"output_attentions": false,
|
| 171 |
"output_hidden_states": false,
|
| 172 |
-
"output_scores": false,
|
| 173 |
-
"pad_token_id": null,
|
| 174 |
"patch_size": 14,
|
| 175 |
-
"prefix": null,
|
| 176 |
-
"problem_type": null,
|
| 177 |
-
"pruned_heads": {},
|
| 178 |
"qk_normalization": false,
|
| 179 |
"qkv_bias": true,
|
| 180 |
-
"remove_invalid_values": false,
|
| 181 |
-
"repetition_penalty": 1.0,
|
| 182 |
"return_dict": true,
|
| 183 |
-
"return_dict_in_generate": false,
|
| 184 |
-
"sep_token_id": null,
|
| 185 |
-
"suppress_tokens": null,
|
| 186 |
-
"task_specific_params": null,
|
| 187 |
-
"temperature": 1.0,
|
| 188 |
-
"tf_legacy_loss": false,
|
| 189 |
-
"tie_encoder_decoder": false,
|
| 190 |
-
"tie_word_embeddings": true,
|
| 191 |
-
"tokenizer_class": null,
|
| 192 |
-
"top_k": 50,
|
| 193 |
-
"top_p": 1.0,
|
| 194 |
"torch_dtype": "bfloat16",
|
| 195 |
-
"torchscript": false,
|
| 196 |
"transformers_version": "4.45.1",
|
| 197 |
-
"typical_p": 1.0,
|
| 198 |
"use_bfloat16": true,
|
| 199 |
"use_flash_attn": true
|
| 200 |
}
|
|
|
|
| 110 |
"select_layer": -1,
|
| 111 |
"template": "internvl2_5",
|
| 112 |
"torch_dtype": "float16",
|
|
|
|
| 113 |
"use_backbone_lora": 0,
|
| 114 |
"use_llm_lora": 0,
|
| 115 |
"use_thumbnail": true,
|
| 116 |
"vision_config": {
|
|
|
|
|
|
|
| 117 |
"architectures": [
|
| 118 |
"InternVisionModel"
|
| 119 |
],
|
| 120 |
"attention_dropout": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
"drop_path_rate": 0.0,
|
| 122 |
"dropout": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
"hidden_act": "gelu",
|
| 124 |
"hidden_size": 1024,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
"image_size": 448,
|
| 126 |
"initializer_factor": 1.0,
|
| 127 |
"initializer_range": 0.02,
|
| 128 |
"intermediate_size": 4096,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
"layer_norm_eps": 1e-06,
|
|
|
|
|
|
|
|
|
|
| 130 |
"model_type": "intern_vit_6b",
|
|
|
|
| 131 |
"norm_type": "layer_norm",
|
| 132 |
"num_attention_heads": 16,
|
|
|
|
|
|
|
| 133 |
"num_channels": 3,
|
| 134 |
"num_hidden_layers": 24,
|
|
|
|
| 135 |
"output_attentions": false,
|
| 136 |
"output_hidden_states": false,
|
|
|
|
|
|
|
| 137 |
"patch_size": 14,
|
|
|
|
|
|
|
|
|
|
| 138 |
"qk_normalization": false,
|
| 139 |
"qkv_bias": true,
|
|
|
|
|
|
|
| 140 |
"return_dict": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
"torch_dtype": "bfloat16",
|
|
|
|
| 142 |
"transformers_version": "4.45.1",
|
|
|
|
| 143 |
"use_bfloat16": true,
|
| 144 |
"use_flash_attn": true
|
| 145 |
}
|