Image-Text-to-Text
Transformers
Safetensors
English
KeyeVL2
feature-extraction
multimodal
conversational
custom_code
Instructions to use Kling-Keye/Keye-VL-2.0-30B-A3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kling-Keye/Keye-VL-2.0-30B-A3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Kling-Keye/Keye-VL-2.0-30B-A3B", 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("Kling-Keye/Keye-VL-2.0-30B-A3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kling-Keye/Keye-VL-2.0-30B-A3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kling-Keye/Keye-VL-2.0-30B-A3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kling-Keye/Keye-VL-2.0-30B-A3B", "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/Kling-Keye/Keye-VL-2.0-30B-A3B
- SGLang
How to use Kling-Keye/Keye-VL-2.0-30B-A3B 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 "Kling-Keye/Keye-VL-2.0-30B-A3B" \ --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": "Kling-Keye/Keye-VL-2.0-30B-A3B", "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 "Kling-Keye/Keye-VL-2.0-30B-A3B" \ --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": "Kling-Keye/Keye-VL-2.0-30B-A3B", "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 Kling-Keye/Keye-VL-2.0-30B-A3B with Docker Model Runner:
docker model run hf.co/Kling-Keye/Keye-VL-2.0-30B-A3B
Download config.json from Kling-Keye/Keye-VL-2.0-30B-A3B: direct link, hf CLI and curl.
- Browser
- Download file 2.52 kB
-
https://huggingface.co/Kling-Keye/Keye-VL-2.0-30B-A3B/resolve/main/config.json
- Command line
-
hf download hf://Kling-Keye/Keye-VL-2.0-30B-A3B/config.json
-
curl -L -o config.json https://huggingface.co/Kling-Keye/Keye-VL-2.0-30B-A3B/resolve/main/config.json
2.52 kB
| { | |
| "architectures": [ | |
| "KeyeVL2MoeForConditionalGeneration" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoConfig": "configuration_keye_vl_2.KeyeVL2Config", | |
| "AutoModel": "modeling_keye_topk_mask_30ba3b.KeyeVL2MoeForConditionalGeneration", | |
| "AutoModelForCausalLM": "modeling_keye_topk_mask_30ba3b.KeyeVL2MoeForConditionalGeneration" | |
| }, | |
| "bos_token_id": 151643, | |
| "decoder_sparse_step": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 151645, | |
| "fast_video_token_id": 151678, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "image_token_id": 151655, | |
| "initializer_factor": 1.0, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 6144, | |
| "max_position_embeddings": 262144, | |
| "max_window_layers": 48, | |
| "mlp_only_layers": [], | |
| "model_type": "KeyeVL2", | |
| "moe_intermediate_size": 768, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 32, | |
| "num_experts": 128, | |
| "num_experts_per_tok": 8, | |
| "num_hidden_layers": 48, | |
| "num_key_value_heads": 4, | |
| "num_local_experts": 128, | |
| "output_router_logits": false, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": { | |
| "mrope_section": [ | |
| 16, | |
| 24, | |
| 24 | |
| ], | |
| "rope_type": "default", | |
| "type": "default" | |
| }, | |
| "rope_theta": 10000000, | |
| "router_aux_loss_coef": 0.001, | |
| "router_jitter_noise": 0.01, | |
| "sa_config": { | |
| "indexer_head_dim": 64, | |
| "indexer_num_heads": 16, | |
| "indexer_num_kv_heads": 1, | |
| "kv_chunk_size": 512, | |
| "q_chunk_size": 512, | |
| "topk": 2048 | |
| }, | |
| "sliding_window": null, | |
| "tie_word_embeddings": false, | |
| "transformers_version": "4.57.3", | |
| "use_cache": true, | |
| "use_sliding_window": false, | |
| "video_token_id": 151656, | |
| "vision_config": { | |
| "architectures": [ | |
| "KeyeVL2VisionModel" | |
| ], | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoConfig": "configuration_keye_vl_2.KeyeVL2VisionConfig", | |
| "AutoModel": "modeling_keye_vl_2.KeyeVL2VisionModel" | |
| }, | |
| "dtype": "bfloat16", | |
| "has_learnable_position_embedding": true, | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "hidden_size": 1152, | |
| "image_size": 384, | |
| "intermediate_size": 4304, | |
| "layer_norm_eps": 1e-06, | |
| "model_type": "KeyeVL2", | |
| "num_attention_heads": 16, | |
| "num_channels": 3, | |
| "num_hidden_layers": 27, | |
| "patch_size": 14, | |
| "rope_theta": 10000, | |
| "spatial_merge_size": 2, | |
| "temporal_patch_size": 2, | |
| "tokens_per_second": 2 | |
| }, | |
| "vision_end_token_id": 151653, | |
| "vision_start_token_id": 151652, | |
| "vision_token_id": 151654, | |
| "vocab_size": 151936 | |
| } | |