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
Document LA Flash implementation details
Browse files- kernel_utils/README.md +25 -0
kernel_utils/README.md
CHANGED
|
@@ -25,6 +25,31 @@ types:
|
|
| 25 |
| `0` | Full attention over the listed key segment or packed key segments. |
|
| 26 |
| `1` | Bottom-right causal attention. |
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
## Runtime Knobs
|
| 29 |
|
| 30 |
| Variable | Default | Meaning |
|
|
|
|
| 25 |
| `0` | Full attention over the listed key segment or packed key segments. |
|
| 26 |
| `1` | Bottom-right causal attention. |
|
| 27 |
|
| 28 |
+
## How It Works
|
| 29 |
+
|
| 30 |
+
`batch_utils.hybrid_runtime` builds sparse range plans for the text decoder.
|
| 31 |
+
Each plan describes which query token intervals attend to which key/value token
|
| 32 |
+
intervals. `kernel_utils.range_attention` executes those plans with
|
| 33 |
+
FlashAttention instead of materializing dense SDPA masks.
|
| 34 |
+
|
| 35 |
+
The runtime follows three paths:
|
| 36 |
+
|
| 37 |
+
- **Packed simple plans:** when each query range maps to one contiguous
|
| 38 |
+
key/value range, LA Flash flattens the selected ranges, builds FlashAttention
|
| 39 |
+
`cu_seqlens_q` / `cu_seqlens_k`, and calls `flash_attn_varlen_func` directly.
|
| 40 |
+
- **Packed MTP full-window plans:** for hybrid MTP decode, multiple full
|
| 41 |
+
key/value windows for the same query block are concatenated into one packed
|
| 42 |
+
key/value sequence before the FlashAttention call. This keeps the sparse
|
| 43 |
+
memory profile without constructing a `[B,H,Q,K]` attention mask.
|
| 44 |
+
- **Compatible multi-segment plans:** when a query range attends to multiple
|
| 45 |
+
segments that cannot be packed as one sequence, each segment is evaluated with
|
| 46 |
+
FlashAttention and the partial outputs are merged with the standard
|
| 47 |
+
log-sum-exp softmax composition.
|
| 48 |
+
|
| 49 |
+
The output tensor shape and dtype match the decoder attention output expected
|
| 50 |
+
by the model. This path is inference-oriented and depends on FlashAttention's
|
| 51 |
+
forward kernels; it is not a custom autograd training backend.
|
| 52 |
+
|
| 53 |
## Runtime Knobs
|
| 54 |
|
| 55 |
| Variable | Default | Meaning |
|