Image-Text-to-Text
Transformers
Safetensors
uhr_bat
text-generation
vision-language
remote-sensing
ultra-high-resolution
query-guided-token-compression
qwen2
longva
uhr-bat
conversational
custom_code
Instructions to use RL-MIND/UHR-BAT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RL-MIND/UHR-BAT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="RL-MIND/UHR-BAT", 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("RL-MIND/UHR-BAT", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RL-MIND/UHR-BAT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RL-MIND/UHR-BAT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RL-MIND/UHR-BAT", "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/RL-MIND/UHR-BAT
- SGLang
How to use RL-MIND/UHR-BAT 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 "RL-MIND/UHR-BAT" \ --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": "RL-MIND/UHR-BAT", "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 "RL-MIND/UHR-BAT" \ --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": "RL-MIND/UHR-BAT", "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 RL-MIND/UHR-BAT with Docker Model Runner:
docker model run hf.co/RL-MIND/UHR-BAT
| { | |
| "_name_or_path": "FelixKAI/UHR-BAT", | |
| "architectures": [ | |
| "UHRBATForCausalLM" | |
| ], | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 151643, | |
| "debug_print_token_counts": false, | |
| "enable_scale_pos_residual": true, | |
| "eos_token_id": 151645, | |
| "hidden_act": "silu", | |
| "hidden_size": 3584, | |
| "image_aspect_ratio": "pad", | |
| "image_crop_resolution": null, | |
| "image_grid_pinpoints": null, | |
| "image_split_resolution": null, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 18944, | |
| "max_position_embeddings": 224000, | |
| "max_window_layers": 28, | |
| "mm_hidden_size": 1024, | |
| "mm_patch_merge_type": "unires", | |
| "mm_projector_lr": null, | |
| "mm_projector_type": "mlp2x_gelu", | |
| "mm_resampler_type": null, | |
| "mm_spatial_pool_mode": "average", | |
| "mm_spatial_pool_stride": 2, | |
| "mm_tunable_parts": "mm_mlp_adapter,mm_language_model,scale_residuals", | |
| "mm_use_im_patch_token": false, | |
| "mm_use_im_start_end": false, | |
| "mm_vision_select_feature": "patch", | |
| "mm_vision_select_layer": -2, | |
| "mm_vision_tower": "openai/clip-vit-large-patch14-336", | |
| "mm_vision_tower_lr": null, | |
| "model_type": "uhr_bat", | |
| "multiscale_target_sizes": [ | |
| 672, | |
| 1344, | |
| 2688, | |
| 4032 | |
| ], | |
| "num_attention_heads": 28, | |
| "num_hidden_layers": 28, | |
| "num_key_value_heads": 4, | |
| "pos_skipping_range": 4096, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": null, | |
| "rope_theta": 1000000000.0, | |
| "sam_checkpoint_path": null, | |
| "sam_keep_ratio": null, | |
| "sam_model_type": "vit_h", | |
| "sam_prune_ratio": 0.9, | |
| "sam_prune_target": 0, | |
| "scale_residual_base": 64, | |
| "sliding_window": null, | |
| "tie_word_embeddings": false, | |
| "tokenizer_model_max_length": 20000, | |
| "tokenizer_padding_side": "right", | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.43.4", | |
| "use_cache": true, | |
| "use_mm_proj": true, | |
| "use_pos_skipping": false, | |
| "use_sliding_window": false, | |
| "vision_tower_pretrained": null, | |
| "vocab_size": 152064, | |
| "auto_map": { | |
| "AutoConfig": "configuration_uhr_bat.UHRBATConfig", | |
| "AutoModelForCausalLM": "modeling_uhr_bat.UHRBATForCausalLM" | |
| }, | |
| "library_name": "transformers", | |
| "trust_remote_code": true | |
| } | |