Image-Text-to-Text
Transformers
Safetensors
English
idefics2
multimodal
vision
text-generation-inference
Instructions to use HuggingFaceM4/idefics2-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceM4/idefics2-8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="HuggingFaceM4/idefics2-8b")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("HuggingFaceM4/idefics2-8b") model = AutoModelForMultimodalLM.from_pretrained("HuggingFaceM4/idefics2-8b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HuggingFaceM4/idefics2-8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceM4/idefics2-8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceM4/idefics2-8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceM4/idefics2-8b
- SGLang
How to use HuggingFaceM4/idefics2-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 "HuggingFaceM4/idefics2-8b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceM4/idefics2-8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "HuggingFaceM4/idefics2-8b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceM4/idefics2-8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceM4/idefics2-8b with Docker Model Runner:
docker model run hf.co/HuggingFaceM4/idefics2-8b
Commit History
-
Update README.md
Verified signature4e7c4c8
-
Update README.md
Verified signaturea70c0c0
-
Update README.md
Verified signature633869c
-
Update README.md
Verified signature317fdf2
-
tgi
2c031da -
update readme
87d5d88
-
Add chat template to processor_config.json (#36)
Verified signature- Add chat template to processor_config.json (f38a3b95248373646993deed003c692b649246c1) Co-authored-by: Matthew Carrigan <Rocketknight1@users.noreply.huggingface.co>8e6111a -
Update README.md (#35)
Verified signature- Update README.md (37198fce1bbc2f1a09e116399cd4784349b2f660) Co-authored-by: Salman Faroz <SalmanFaroz@users.noreply.huggingface.co>da7999c
-
gpu memory / inference speed - tradeoffs of quantization
1fa1cbd
-
Update README.md
Verified signaturea44e7e3
-
being explicit with transformers version
Verified signaturebc7e459
-
Update README.md
Verified signature6e13295 -
Comment on image splitting (#4)
Verified signature- Comment on image splitting (d6e40c5cbeb2fbec8f0463afdd1cd937f1090c79) Co-authored-by: Hugo Laurençon <HugoLaurencon@users.noreply.huggingface.co>2c25217
-
typo
Verified signature59e3081 -
Update README.md (#1)
Verified signature- Update README.md (34b9c94ea077c5fecdcbba6b6ab71d0c63d4fd9f) Co-authored-by: Hugo Laurençon <HugoLaurencon@users.noreply.huggingface.co>12d27ed -
Update README.md
Verified signature84bc60f -
readme
335ef98
-
Update generation_config.json
Verified signaturedc2d28f -
Upload folder using huggingface_hub
Verified signaturebc364a7
-
This commit corrects the mistake
3392312
-
add flowchart
036a316
-
fix
8a0f3fa -
idefics2-8b
44328af
-
initial commit
Verified signaturec828c05