Image-Text-to-Text
Transformers
Safetensors
English
locateanything
feature-extraction
nvidia
eagle
vision
object-detection
grounding
conversational
custom_code
Instructions to use Akfmsk/LocateAnything-3B-custom with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Akfmsk/LocateAnything-3B-custom with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Akfmsk/LocateAnything-3B-custom", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Akfmsk/LocateAnything-3B-custom", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Akfmsk/LocateAnything-3B-custom with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Akfmsk/LocateAnything-3B-custom" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Akfmsk/LocateAnything-3B-custom", "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/Akfmsk/LocateAnything-3B-custom
- SGLang
How to use Akfmsk/LocateAnything-3B-custom 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 "Akfmsk/LocateAnything-3B-custom" \ --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": "Akfmsk/LocateAnything-3B-custom", "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 "Akfmsk/LocateAnything-3B-custom" \ --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": "Akfmsk/LocateAnything-3B-custom", "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 Akfmsk/LocateAnything-3B-custom with Docker Model Runner:
docker model run hf.co/Akfmsk/LocateAnything-3B-custom
Commit History
-
Guarantee completely safe memory bounds by chunking to 1024 and compiling every single layer independently, preventing the XLA scheduler from overlapping chunk lifetimes across layers
7976ec3 -
Revert padding and use a 4-chunk Memory-Efficient Attention to perfectly balance the 4.2GB peak memory and 16-node XLA graph size, compiling instantly without OOMing the TPU or Host RAM
5aa7afb -
Fix severe XLA compiler memory leak and 10-minute hang by padding both head_dim and seq_len to multiples of 128 to perfectly satisfy the TPU Flash Attention kernel, completely eliminating the fallback graph explosion
fe892dd -
Fix type error for Transformers 5.12+ where DynamicCache uses '.layers' instead of '.key_cache'
3f5fa6d -
Fix type error: 'DynamicCache' object is not subscriptable by explicitly accessing .key_cache and .value_cache on newer Transformers versions
7e3f58a -
Implement manual Memory-Efficient Attention by chunking the Query sequence dimension to forcefully bound the memory of PyTorch XLA's naive fallback kernel from 17.2 GB down to safe 1 GB blocks
2e46ef6 -
Pad head_dim from 72 to 128 to trick PyTorch XLA into mapping the attention calculation to the highly-optimized Pallas TPU Flash Attention kernel, completely avoiding the catastrophic O(N^2) memory fallback
8f6ba09 -
Trigger PyTorch XLA Flash Attention kernel natively by calling F.scaled_dot_product_attention without any explicit masks or eager math, resolving the 8.26GB Out-Of-Memory failure and restoring the chunked graph execution
d72b51f -
Inject xm.mark_step() every 4 layers inside the Vision Model encoder to prevent PyTorch XLA from accumulating 8.3GB of intermediate activations during graph compilation and execution
703d98a -
Defeat XLA compiler graph rewriter by injecting mathematical fusion breakers into the vision model batched matmuls, preventing XLA from aggressively flattening them back into a single massive 16416x16416 SDPA
672baa4 -
Fix massive OOM in the vision model by replacing the 16416x16416 block-diagonal attention mask with a memory-efficient batched slice SDPA
e640dfc -
Sever XLA upper bound tracking on chunk_embeds slice to prevent the compiler from padding the attention matrix back to 16416x16416
2d02f79 -
Switch to dynamic torch.where fusion breaker to guarantee XLA algebraic simplifier cannot bypass it
3b4b10e -
Disable PyTorch XLA dot_product_attention_fusion pattern matching by adding a mathematically invisible constant, preventing the TPU compiler from padding q_len to kv_len in the SDPA CustomCall fallback
0075ff2 -
Force eager attention mode to bypass PyTorch XLA Math SDPA padding bug which allocates a square matrix for dynamic sequence lengths
8ed3055 -
Pad final chunk to keep q_len perfectly static, preventing PyTorch XLA from bucketing q_len to 16416 and allocating a 17GB square matrix during Math SDPA
4c381d5 -
Remove forced attention_mask=None to prevent PyTorch XLA Math SDPA from allocating a full max_len^2 causal mask during generation chunks
deef94a -
Move 16416-sized StaticCache and padded_input_ids allocations after the chunked prefill loop to prevent XLA dynamic shape padding from blowing up the Math SDPA matrix to 17GB
c0aebd8 -
Implement chunked prefill (4096 tokens per chunk) to avoid Math backend OOM on TPU
cbd3875 -
Explicitly set attention_mask=None for SDPA prefill to trigger Pallas FlashAttention and avoid OOM
1c64569 -
Fix DynamicCache iteration in transformers 5.0
40a8955 -
Fix DynamicCache indexing
cceb21b -
Fix next_decoder_cache.to_legacy_cache() error in Qwen2Model
01e5143 -
Fix max_cache_len property conflict in LocateAnythingStaticCache
a5ae7ae
-
Fix TPU OOM by bypassing StaticCache for prefill and implementing custom caching logic without explicit 4D masks
98e1225 -
Safely retrieve max_cache_length in Qwen2ForCausalLM
6ef731e -
Use get_seq_length() instead of seen_tokens in Qwen2ForCausalLM
00c4f1b -
Call post_init in LocateAnythingForConditionalGeneration constructor
aa5099a -
Remove _tied_weights_keys from Qwen2ForCausalLM
cf5963c -
Use getattr for pad_token_id in Qwen2Model
306fd68 -
Set default attention implementation to sdpa
d208661 -
Use relative import for Qwen2Config in configuration_locateanything.py
e5f776d -
Set _MAGI_AVAILABLE = False in modeling_qwen2.py
e125991
-
Restore _CONFIG_FOR_DOC and other doc strings in modeling_qwen2.py
75157c2
-
Initial custom version
6fd1cee
-
Document LA Flash implementation details
Verified signaturec32291c -
Refine LA Flash plan documentation
Verified signaturefb9f8b1 -
Update README.md
Verified signaturefd5777e -
Add batch inference and LA Flash runtime
Verified signature8d21b77
-
Update README.md
Verified signature272068e
-
Update README.md
Verified signature7a81d81 -
Update README.md
Verified signature567ab66
-
Initial snapshot
d979fab