Image-Text-to-Text
Transformers
PyTorch
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Run this model with HF Jobs
Run OpenGVLab/InternVL2-26B-AWQ on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenGVLab/InternVL2-26B-AWQ. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenGVLab/InternVL2-26B-AWQ on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/OpenGVLab/InternVL2-26B-AWQ. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use OpenGVLab/InternVL2-26B-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-26B-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-26B-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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL2-26B-AWQ", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL2-26B-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-26B-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-26B-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-26B-AWQ
- SGLang
How to use OpenGVLab/InternVL2-26B-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-26B-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-26B-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-26B-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-26B-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-26B-AWQ with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-26B-AWQ
Upload folder using huggingface_hub
Browse filesFiles changed (4)
64 unmodified lines6566676869707132 unmodified lines10410510610710810911064 unmodified linesLMDeploy's `api_server` enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:```shelllmdeploy serve api_server OpenGVLab/InternVL2-26B-AWQ --server-port 23333```To use the OpenAI-style interface, you need to install OpenAI:32 unmodified lines## LicenseThis project is released under the MIT license, while InternLM is licensed under the Apache-2.0 license.## Citation64 unmodified lines6566676869707132 unmodified lines10410510610710810911064 unmodified linesLMDeploy's `api_server` enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:```shelllmdeploy serve api_server OpenGVLab/InternVL2-26B-AWQ --backend turbomind --server-port 23333 --model-format awq```To use the OpenAI-style interface, you need to install OpenAI:32 unmodified lines## LicenseThis project is released under the MIT license, while InternLM2 is licensed under the Apache-2.0 license.## Citation
123456108 unmodified lines115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205{"_commit_hash": null,"_name_or_path": "/mnt/142/InternVL2-26B","architectures": ["InternVLChatModel"],108 unmodified lines"select_layer": -1,"template": "internlm2-chat","torch_dtype": "float16","transformers_version": null,"use_backbone_lora": 0,"use_llm_lora": 0,"use_thumbnail": true,"vision_config": {"_name_or_path": "","add_cross_attention": false,"architectures": ["InternVisionModel"],"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,"drop_path_rate": 0.0,"dropout": 0.0,"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","hidden_size": 3200,"id2label": {"0": "LABEL_0","1": "LABEL_1"},"image_size": 448,"initializer_factor": 0.1,"initializer_range": 1e-10,"intermediate_size": 12800,"is_decoder": false,"is_encoder_decoder": false,"label2id": {"LABEL_0": 0,"LABEL_1": 1},"layer_norm_eps": 1e-06,"length_penalty": 1.0,"max_length": 20,"min_length": 0,"model_type": "intern_vit_6b","no_repeat_ngram_size": 0,"norm_type": "rms_norm","num_attention_heads": 25,"num_beam_groups": 1,"num_beams": 1,"num_channels": 3,"num_hidden_layers": 45,"num_return_sequences": 1,"output_attentions": false,"output_hidden_states": false,"output_scores": false,"pad_token_id": null,"patch_size": 14,"prefix": null,"problem_type": null,"pruned_heads": {},"qk_normalization": true,"qkv_bias": false,"remove_invalid_values": false,"repetition_penalty": 1.0,"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": "bfloat16","torchscript": false,"transformers_version": "4.40.0","typical_p": 1.0,"use_bfloat16": true,"use_flash_attn": true}12345108 unmodified lines114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149{"_commit_hash": null,"architectures": ["InternVLChatModel"],108 unmodified lines"select_layer": -1,"template": "internlm2-chat","torch_dtype": "float16","use_backbone_lora": 0,"use_llm_lora": 0,"use_thumbnail": true,"vision_config": {"architectures": ["InternVisionModel"],"attention_dropout": 0.0,"drop_path_rate": 0.0,"dropout": 0.0,"hidden_act": "gelu","hidden_size": 3200,"image_size": 448,"initializer_factor": 0.1,"initializer_range": 1e-10,"intermediate_size": 12800,"layer_norm_eps": 1e-06,"model_type": "intern_vit_6b","norm_type": "rms_norm","num_attention_heads": 25,"num_channels": 3,"num_hidden_layers": 45,"output_attentions": false,"output_hidden_states": false,"patch_size": 14,"qk_normalization": true,"qkv_bias": false,"return_dict": true,"torch_dtype": "bfloat16","transformers_version": "4.40.0","use_bfloat16": true,"use_flash_attn": true}
367 unmodified lines368369370371372373367 unmodified linesclass InternVisionModel(PreTrainedModel):main_input_name = 'pixel_values'config_class = InternVisionConfig_no_split_modules = ['InternVisionEncoderLayer']367 unmodified lines368369370371372373374367 unmodified linesclass InternVisionModel(PreTrainedModel):main_input_name = 'pixel_values'_supports_flash_attn_2 = Trueconfig_class = InternVisionConfig_no_split_modules = ['InternVisionEncoderLayer']
34 unmodified lines35363738394034 unmodified linesclass InternVLChatModel(PreTrainedModel):config_class = InternVLChatConfigmain_input_name = 'pixel_values'_no_split_modules = ['InternVisionModel', 'LlamaDecoderLayer', 'InternLM2DecoderLayer']def __init__(self, config: InternVLChatConfig, vision_model=None, language_model=None):34 unmodified lines3536373839404134 unmodified linesclass InternVLChatModel(PreTrainedModel):config_class = InternVLChatConfigmain_input_name = 'pixel_values'_supports_flash_attn_2 = True_no_split_modules = ['InternVisionModel', 'LlamaDecoderLayer', 'InternLM2DecoderLayer']def __init__(self, config: InternVLChatConfig, vision_model=None, language_model=None):
README.md+2-2
config.json-56
modeling_intern_vit.py+1
modeling_internvl_chat.py+1