Instructions to use TIGER-Lab/VLM2Vec-Full with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/VLM2Vec-Full with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TIGER-Lab/VLM2Vec-Full", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/VLM2Vec-Full", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TIGER-Lab/VLM2Vec-Full with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/VLM2Vec-Full" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/VLM2Vec-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TIGER-Lab/VLM2Vec-Full
- SGLang
How to use TIGER-Lab/VLM2Vec-Full 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 "TIGER-Lab/VLM2Vec-Full" \ --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": "TIGER-Lab/VLM2Vec-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "TIGER-Lab/VLM2Vec-Full" \ --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": "TIGER-Lab/VLM2Vec-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TIGER-Lab/VLM2Vec-Full with Docker Model Runner:
docker model run hf.co/TIGER-Lab/VLM2Vec-Full
Support native Transformers loading
Browse filesI'm adding native Phi-3-vision support to Transformers in https://github.com/huggingface/transformers/pull/51214, and VLM2Vec-Full loads with the same classes. This PR declares `<|image|>` as the image token in `tokenizer_config.json` and sets `rstrip: false` on it (also in `tokenizer.json`); with the native processor, write `<|image|>` where the remote processor used `<|image_1|>`.
The remote code, `auto_map` and the weights are unchanged, so `trust_remote_code=True` keeps working: with transformers 4.48.3 the tokenization is identical with and without these files.
Files changed (2)
430 unmodified lines431432433434435436437430 unmodified lines"content": "<|image|>","single_word": false,"lstrip": false,"rstrip": true,"normalized": false,"special": true}430 unmodified lines431432433434435436437430 unmodified lines"content": "<|image|>","single_word": false,"lstrip": false,"rstrip": false,"normalized": false,"special": true}
381 unmodified lines38238338438538638738810 unmodified lines399400401402403404381 unmodified lines"content": "<|image|>","lstrip": false,"normalized": false,"rstrip": true,"single_word": false,"special": true}10 unmodified lines"bos_token": "<s>","chat_template": "{% for message in messages %}{{'<|' + message['role'] + '|>' + '\n' + message['content'] + '<|end|>\n' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{- '<|assistant|>\n' -}}{% endif %}","clean_up_tokenization_spaces": false,"eos_token": "<|endoftext|>","legacy": false,"model_max_length": 131072,381 unmodified lines38238338438538638738810 unmodified lines399400401402403404405406407381 unmodified lines"content": "<|image|>","lstrip": false,"normalized": false,"rstrip": false,"single_word": false,"special": true}10 unmodified lines"bos_token": "<s>","chat_template": "{% for message in messages %}{{'<|' + message['role'] + '|>' + '\n' + message['content'] + '<|end|>\n' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{- '<|assistant|>\n' -}}{% endif %}","clean_up_tokenization_spaces": false,"extra_special_tokens": {"image_token": "<|image|>"},"eos_token": "<|endoftext|>","legacy": false,"model_max_length": 131072,