Image-Text-to-Text
Transformers
Safetensors
English
locateanything
feature-extraction
nvidia
eagle
vision
object-detection
grounding
conversational
custom_code
Instructions to use nvidia/LocateAnything-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/LocateAnything-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nvidia/LocateAnything-3B", 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("nvidia/LocateAnything-3B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/LocateAnything-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/LocateAnything-3B" # 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/LocateAnything-3B", "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/LocateAnything-3B
- SGLang
How to use nvidia/LocateAnything-3B 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/LocateAnything-3B" \ --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/LocateAnything-3B", "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/LocateAnything-3B" \ --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/LocateAnything-3B", "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/LocateAnything-3B with Docker Model Runner:
docker model run hf.co/nvidia/LocateAnything-3B
Batch Utils
batch_utils contains the optional batched hybrid generation runtime for
LocateAnything. It keeps the model loading, tokenization, image feature caching,
sampling, and scheduler code used by batch_infer.py and the detection
experiments.
Runtime Modes
LA_FLASH_ATTN=sdpa: stock PyTorch SDPA path.LA_FLASH_ATTN=eager: eager attention path for debugging.LA_FLASH_ATTN=magi: MagiAttention path when MagiAttention is installed.LA_FLASH_ATTN=la_flash: LA Flash sparse range backend fromkernel_utils.
Common Knobs
| Variable | Default | Meaning |
|---|---|---|
LA_FLASH_MODEL |
nvidia/LocateAnything-3B |
HF model id or local model directory. |
LA_FLASH_ATTN |
sdpa |
LLM attention backend. |
LA_FLASH_VISION_ATTN |
auto |
Vision encoder attention: auto, flash_attention_2, sdpa, or eager. |
LA_FLASH_STRICT_ATTN |
0 |
Set 1 to fail instead of falling back to SDPA. |
LA_FLASH_HYBRID_SCHEDULER |
eager |
Hybrid decode scheduler. |
LA_FLASH_HYBRID_GROUP_SIZE |
0 |
Scheduler group size; 0 lets the runtime decide. |
LA_FLASH_VISION_ENCODE_BATCH_SIZE |
8 |
Maximum images per MoonViT encode micro-batch. |
LA_FLASH_KV_PACK_TOKEN_BUDGET |
0 |
Optional KV packing memory cap for long-tail batches. |
LA_FLASH_DENSE_BACKEND |
sdpa |
Dense worker/prefill attention backend. Keep this as sdpa; LA Flash is used for sparse range plans. |
LA_FLASH_SEGMENT_FASTPATH |
auto |
Sparse MTP decode uses FlashAttention varlen multi-segment merge by default. |
CLI Example
python batch_infer.py \
--model nvidia/LocateAnything-3B \
--attn la_flash \
--scheduler pipeline \
--batch-size 4 \
--image /path/to/image.jpg \
--query "person</c>car"
For JSONL input, each row should contain:
{"image": "/path/to/image.jpg", "query": "person</c>car"}
Training Boundary
This package is for inference and evaluation. Training remains on the
MagiAttention backend; the batched sparse-plan decode runtime does not support
the labels training path.