Image-Text-to-Text
Transformers
Safetensors
qwen3_5
qwen3.5
video
video-captioning
data-engine
conversational
Instructions to use nvidia/Flora-Captioner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/Flora-Captioner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nvidia/Flora-Captioner") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("nvidia/Flora-Captioner") model = AutoModelForMultimodalLM.from_pretrained("nvidia/Flora-Captioner", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/Flora-Captioner with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/Flora-Captioner" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Flora-Captioner", "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/nvidia/Flora-Captioner
- SGLang
How to use nvidia/Flora-Captioner 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 "nvidia/Flora-Captioner" \ --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": "nvidia/Flora-Captioner", "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 "nvidia/Flora-Captioner" \ --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": "nvidia/Flora-Captioner", "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 nvidia/Flora-Captioner with Docker Model Runner:
docker model run hf.co/nvidia/Flora-Captioner
Document third-party inference dependencies
#2
by OmarLaymounNvidia - opened
batch_utils/CODE_MANIFEST.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
"batch_utils/README.md": {
|
| 4 |
-
"bytes":
|
| 5 |
-
"sha256": "
|
| 6 |
},
|
| 7 |
"batch_utils/__init__.py": {
|
| 8 |
"bytes": 91,
|
|
@@ -167,6 +167,10 @@
|
|
| 167 |
"infer.py": {
|
| 168 |
"bytes": 171,
|
| 169 |
"sha256": "8cddbb43ba5b9d884e8f771b9c9e219ce2e0a3c1d71a94a75d02b1d3b730f93d"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
}
|
| 171 |
},
|
| 172 |
"schema_version": "flora_inference_code_manifest_v1"
|
|
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
"batch_utils/README.md": {
|
| 4 |
+
"bytes": 4337,
|
| 5 |
+
"sha256": "f03e4f204b906db2b11a447585e09b6e01af5129a88b9123a5066087309f3007"
|
| 6 |
},
|
| 7 |
"batch_utils/__init__.py": {
|
| 8 |
"bytes": 91,
|
|
|
|
| 167 |
"infer.py": {
|
| 168 |
"bytes": 171,
|
| 169 |
"sha256": "8cddbb43ba5b9d884e8f771b9c9e219ce2e0a3c1d71a94a75d02b1d3b730f93d"
|
| 170 |
+
},
|
| 171 |
+
"batch_utils/THIRD_PARTY_NOTICES.md": {
|
| 172 |
+
"bytes": 1497,
|
| 173 |
+
"sha256": "b73d47aa224b69e8c97850912c23d8b29219126568a11fa41ee3d085a8a430a3"
|
| 174 |
}
|
| 175 |
},
|
| 176 |
"schema_version": "flora_inference_code_manifest_v1"
|
batch_utils/README.md
CHANGED
|
@@ -8,6 +8,8 @@ included; no internal source checkout or running demo is required.
|
|
| 8 |
|
| 9 |
## Setup
|
| 10 |
|
|
|
|
|
|
|
| 11 |
Python 3.12 and a CUDA GPU with 80 GB VRAM are the validated configuration.
|
| 12 |
The two models run sequentially. Download/cache space of at least 150 GB is
|
| 13 |
recommended for the released FP32 Captioner, base model, and adapter.
|
|
|
|
| 8 |
|
| 9 |
## Setup
|
| 10 |
|
| 11 |
+
This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use. See [third-party notices](THIRD_PARTY_NOTICES.md).
|
| 12 |
+
|
| 13 |
Python 3.12 and a CUDA GPU with 80 GB VRAM are the validated configuration.
|
| 14 |
The two models run sequentially. Download/cache space of at least 150 GB is
|
| 15 |
recommended for the released FP32 Captioner, base model, and adapter.
|
batch_utils/THIRD_PARTY_NOTICES.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Third-party notices
|
| 2 |
+
|
| 3 |
+
The inference scripts use the packages below, installed separately by the setup commands. These packages are not bundled in this repository. The requirements match [requirements.txt](requirements.txt).
|
| 4 |
+
|
| 5 |
+
The links identify upstream project licenses. Installed distributions and their dependencies retain their own licenses and notices. For version ranges, consult the license files supplied with the installed version.
|
| 6 |
+
|
| 7 |
+
| Requirement | Upstream license |
|
| 8 |
+
| --- | --- |
|
| 9 |
+
| `torch==2.11.0` | [BSD-3-Clause](https://github.com/pytorch/pytorch/blob/v2.11.0/LICENSE) |
|
| 10 |
+
| `torchvision==0.26.0` | [BSD-3-Clause](https://github.com/pytorch/vision/blob/v0.26.0/LICENSE) |
|
| 11 |
+
| `huggingface_hub==1.33.0` | [Apache-2.0](https://github.com/huggingface/huggingface_hub/blob/v1.33.0/LICENSE) |
|
| 12 |
+
| `transformers==5.8.1` | [Apache-2.0](https://github.com/huggingface/transformers/blob/v5.8.1/LICENSE) |
|
| 13 |
+
| `peft==0.18.1` | [Apache-2.0](https://github.com/huggingface/peft/blob/v0.18.1/LICENSE) |
|
| 14 |
+
| `accelerate==1.12.0` | [Apache-2.0](https://github.com/huggingface/accelerate/blob/v1.12.0/LICENSE) |
|
| 15 |
+
| `safetensors==0.7.0` | [Apache-2.0](https://github.com/huggingface/safetensors/blob/v0.7.0/LICENSE) |
|
| 16 |
+
| `av==16.0.1` | [BSD-3-Clause](https://github.com/PyAV-Org/PyAV/blob/v16.0.1/LICENSE.txt) |
|
| 17 |
+
| `numpy<3` | [BSD-3-Clause](https://github.com/numpy/numpy/blob/main/LICENSE.txt) |
|
| 18 |
+
| `Pillow>=11,<13` | [PIL Software License (MIT-CMU)](https://github.com/python-pillow/Pillow/blob/main/LICENSE) |
|