Instructions to use OpenGVLab/InternVL-Chat-V1-5-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL-Chat-V1-5-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-AWQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL-Chat-V1-5-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-AWQ
- SGLang
How to use OpenGVLab/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-AWQ with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL-Chat-V1-5-AWQ
How to load without lmdeploy?
Is there an example for just transformers?
Thanks for this model, it's really great!
The lmdeploy official docker is also failing to start this model "ModuleNotFoundError: No module named 'timm'"
Try to install a timm?
Like this:
pip install timm==0.9.12
I did try that, I got new errors.
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
File "/opt/py38/bin/lmdeploy", line 11, in <module>
load_entry_point('lmdeploy', 'console_scripts', 'lmdeploy')()
File "/opt/lmdeploy/lmdeploy/cli/entrypoint.py", line 37, in run
args.run(args)
File "/opt/lmdeploy/lmdeploy/cli/serve.py", line 303, in api_server
run_api_server(args.model_path,
File "/opt/lmdeploy/lmdeploy/serve/openai/api_server.py", line 1191, in serve
VariableInterface.async_engine = pipeline_class(
File "/opt/lmdeploy/lmdeploy/serve/vl_async_engine.py", line 21, in __init__
super().__init__(model_path, **kwargs)
File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 206, in __init__
self._build_turbomind(model_path=model_path,
File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 253, in _build_turbomind
self.engine = tm.TurboMind.from_pretrained(
File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 387, in from_pretrained
return cls(model_path=pretrained_model_name_or_path,
File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 161, in __init__
self.model_comm = self._from_hf(model_source=model_source,
File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 270, in _from_hf
output_model = OUTPUT_MODELS.get(output_format)(
File "/opt/lmdeploy/lmdeploy/turbomind/deploy/target_model/fp.py", line 26, in __init__
super().__init__(input_model, cfg, to_file, out_dir)
File "/opt/lmdeploy/lmdeploy/turbomind/deploy/target_model/base.py", line 156, in __init__
self.cfg = self.get_config(cfg)
File "/opt/lmdeploy/lmdeploy/turbomind/deploy/target_model/fp.py", line 38, in get_config
w1, _, _ = bin.ffn(i)
File "/opt/lmdeploy/lmdeploy/turbomind/deploy/source_model/internlm2.py", line 69, in ffn
return self._ffn(i, 'weight')
File "/opt/lmdeploy/lmdeploy/turbomind/deploy/source_model/internlm2.py", line 62, in _ffn
tensor = self.params[
KeyError: 'language_model.model.layers.0.feed_forward.w1.weight'
I would still also prefer to run it directly without lmdeploy if possible, thanks!
I did try that, I got new errors.
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained. Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained. Traceback (most recent call last): File "/opt/py38/bin/lmdeploy", line 11, in <module> load_entry_point('lmdeploy', 'console_scripts', 'lmdeploy')() File "/opt/lmdeploy/lmdeploy/cli/entrypoint.py", line 37, in run args.run(args) File "/opt/lmdeploy/lmdeploy/cli/serve.py", line 303, in api_server run_api_server(args.model_path, File "/opt/lmdeploy/lmdeploy/serve/openai/api_server.py", line 1191, in serve VariableInterface.async_engine = pipeline_class( File "/opt/lmdeploy/lmdeploy/serve/vl_async_engine.py", line 21, in __init__ super().__init__(model_path, **kwargs) File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 206, in __init__ self._build_turbomind(model_path=model_path, File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 253, in _build_turbomind self.engine = tm.TurboMind.from_pretrained( File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 387, in from_pretrained return cls(model_path=pretrained_model_name_or_path, File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 161, in __init__ self.model_comm = self._from_hf(model_source=model_source, File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 270, in _from_hf output_model = OUTPUT_MODELS.get(output_format)( File "/opt/lmdeploy/lmdeploy/turbomind/deploy/target_model/fp.py", line 26, in __init__ super().__init__(input_model, cfg, to_file, out_dir) File "/opt/lmdeploy/lmdeploy/turbomind/deploy/target_model/base.py", line 156, in __init__ self.cfg = self.get_config(cfg) File "/opt/lmdeploy/lmdeploy/turbomind/deploy/target_model/fp.py", line 38, in get_config w1, _, _ = bin.ffn(i) File "/opt/lmdeploy/lmdeploy/turbomind/deploy/source_model/internlm2.py", line 69, in ffn return self._ffn(i, 'weight') File "/opt/lmdeploy/lmdeploy/turbomind/deploy/source_model/internlm2.py", line 62, in _ffn tensor = self.params[ KeyError: 'language_model.model.layers.0.feed_forward.w1.weight'
Can you provide more details including test code and environment configuration?
I would still also prefer to run it directly without lmdeploy if possible, thanks!
Our awq model is generated by lmdeploy. If you want to use autoawq integrated by transformers, you need to make sure that the autoawq library supports our model.