Instructions to use OpenGVLab/InternVL3_5-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL3_5-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL3_5-8B", 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/InternVL3_5-8B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/InternVL3_5-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL3_5-8B" # 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/InternVL3_5-8B", "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/InternVL3_5-8B
- SGLang
How to use OpenGVLab/InternVL3_5-8B 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/InternVL3_5-8B" \ --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/InternVL3_5-8B", "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/InternVL3_5-8B" \ --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/InternVL3_5-8B", "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/InternVL3_5-8B with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL3_5-8B
InternVL config to_dict() includes non-JSON-serializable fields (e.g., torch.dtype), causing PretrainedConfig.__repr__ to crash in vLLM Ray mode
Hi OpenGVLab team,
When deploying OpenGVLab/InternVL (e.g., InternVL2_5-8B) with vLLM (>= 0.11.1 / 0.12.x) using Ray distributed executor (--distributed-executor-backend ray), the service may fail during startup due to a config repr / JSON serialization error.
During initialization, some code path triggers repr(config) (often via structured logging / dataclass repr / Ray context). In Transformers, PretrainedConfig.__repr__() calls to_json_string() → json.dumps(config.to_dict()).
However, InternVL’s custom config to_dict() returns a dict containing non-JSON-serializable objects, e.g.:torch_dtype = torch.bfloat16 (torch.dtype)
This leads to: TypeError: Object of type dtype (or InternLM2Config) is not JSON serializable
vLLM mp mode may not trigger this as frequently, but Ray mode tends to hit repr/serialization paths more often. The core issue is that to_dict() is expected to be JSON-friendly for PretrainedConfig interoperability (repr, save/load, logging).
Please update InternVL’s config implementation (e.g., configuration_internvl_chat.py) to ensure to_dict() returns JSON-serializable types only, for example:
- Convert torch.dtype to str(dtype) (e.g., "bfloat16")
- Recursively convert nested PretrainedConfig objects to dicts (or otherwise ensure plain Python types)
This would improve compatibility across Transformers ecosystem tools (including vLLM Ray).
Thanks!