Image-Text-to-Text
Transformers
Safetensors
English
vision
vlm
vision-language-model
image-text
instruction-tuning
dpo
lora
custom-architecture
conversational
Instructions to use mkd-ai/keural-VLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mkd-ai/keural-VLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="mkd-ai/keural-VLM") 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("mkd-ai/keural-VLM", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mkd-ai/keural-VLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mkd-ai/keural-VLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mkd-ai/keural-VLM", "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/mkd-ai/keural-VLM
- SGLang
How to use mkd-ai/keural-VLM 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 "mkd-ai/keural-VLM" \ --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": "mkd-ai/keural-VLM", "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 "mkd-ai/keural-VLM" \ --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": "mkd-ai/keural-VLM", "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 mkd-ai/keural-VLM with Docker Model Runner:
docker model run hf.co/mkd-ai/keural-VLM
| { | |
| "architectures": [ | |
| "KeuralVisionModel" | |
| ], | |
| "default_token_budget": 256, | |
| "depth": 12, | |
| "dtype": "float32", | |
| "embed_dim": 384, | |
| "keural_config": { | |
| "data": { | |
| "captions_path": "data/indexes/cc3m_wds_train.tsv", | |
| "dataset_name": "cc3m+cc12m", | |
| "extra_sources": [ | |
| { | |
| "captions_path": "data/indexes/cc12m_wds_train.tsv", | |
| "images_root": "data/cc12m" | |
| } | |
| ], | |
| "image_buckets": [ | |
| [ | |
| 224, | |
| 224 | |
| ], | |
| [ | |
| 256, | |
| 256 | |
| ], | |
| [ | |
| 320, | |
| 320 | |
| ] | |
| ], | |
| "images_root": "data/cc3m", | |
| "max_caption_length": 64, | |
| "num_workers": 4, | |
| "pixel_mean": [ | |
| 0.485, | |
| 0.456, | |
| 0.406 | |
| ], | |
| "pixel_std": [ | |
| 0.229, | |
| 0.224, | |
| 0.225 | |
| ], | |
| "text_encoder_name": "sentence-transformers/all-MiniLM-L6-v2" | |
| }, | |
| "loss": { | |
| "hct_alpha": 0.5, | |
| "lambda_hct": 1.0, | |
| "lambda_sal": 1.0, | |
| "learnable_bias_init": -10.0, | |
| "learnable_temperature_init": 2.3, | |
| "primary": "sigmoid_siglip", | |
| "saliency_beta": 0.01, | |
| "saliency_lambda_smooth": 4.0 | |
| }, | |
| "name": "keural-tiny-poc", | |
| "saliency": { | |
| "hidden_channels": 96 | |
| }, | |
| "spatial": { | |
| "depth": 12, | |
| "embed_dim": 384, | |
| "head_dim": 64, | |
| "mlp_ratio": 4, | |
| "norm_eps": 1e-06, | |
| "num_heads": 6, | |
| "rope_base": 10000.0, | |
| "use_pool_token": true | |
| }, | |
| "stem": { | |
| "activation": "gelu", | |
| "channels": [ | |
| 64, | |
| 128, | |
| 256, | |
| 384 | |
| ], | |
| "kernel_size": 3 | |
| }, | |
| "tokenizer": { | |
| "budget_floors": { | |
| "detail": 0, | |
| "global": 4, | |
| "region": 8 | |
| }, | |
| "budget_split": { | |
| "detail": 0.7, | |
| "global": 0.05, | |
| "region": 0.25 | |
| }, | |
| "default_token_budget": 256, | |
| "gumbel_temperature_end": 0.1, | |
| "gumbel_temperature_start": 1.0, | |
| "max_token_budget": 1024, | |
| "nms_radius": { | |
| "detail": 1, | |
| "region": 2 | |
| }, | |
| "roi_align_size": 2, | |
| "saliency_smooth_kernel": { | |
| "detail": 3, | |
| "region": 5 | |
| }, | |
| "temperature_anneal_steps": 10000, | |
| "warmup_steps_fixed_grid": 5000 | |
| }, | |
| "training": { | |
| "batch_size_per_device": 256, | |
| "betas": [ | |
| 0.9, | |
| 0.95 | |
| ], | |
| "gradient_accumulation": 4, | |
| "gradient_checkpointing": false, | |
| "log_every": 50, | |
| "lr": 0.001, | |
| "lr_schedule": "cosine_with_warmup", | |
| "max_steps": 75000, | |
| "optimizer": "adamw", | |
| "precision": "bfloat16", | |
| "save_every": 1000, | |
| "seed": 42, | |
| "warmup_steps": 2000, | |
| "weight_decay": 0.05 | |
| } | |
| }, | |
| "max_token_budget": 1024, | |
| "model_type": "keural_vision", | |
| "num_heads": 6, | |
| "transformers_version": "4.57.2" | |
| } | |