Image-Text-to-Text
Transformers
Safetensors
Korean
English
llava_onevision
gui-agent
web-agent
computer-use
browser
korean
conversational
Instructions to use KORMo-VL/KORMo-Web-10B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KORMo-VL/KORMo-Web-10B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="KORMo-VL/KORMo-Web-10B") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("KORMo-VL/KORMo-Web-10B") model = AutoModelForMultimodalLM.from_pretrained("KORMo-VL/KORMo-Web-10B", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KORMo-VL/KORMo-Web-10B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KORMo-VL/KORMo-Web-10B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KORMo-VL/KORMo-Web-10B", "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/KORMo-VL/KORMo-Web-10B
- SGLang
How to use KORMo-VL/KORMo-Web-10B 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 "KORMo-VL/KORMo-Web-10B" \ --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": "KORMo-VL/KORMo-Web-10B", "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 "KORMo-VL/KORMo-Web-10B" \ --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": "KORMo-VL/KORMo-Web-10B", "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 KORMo-VL/KORMo-Web-10B with Docker Model Runner:
docker model run hf.co/KORMo-VL/KORMo-Web-10B
Download kormo_load.py from KORMo-VL/KORMo-Web-10B: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/KORMo-VL/KORMo-Web-10B/resolve/main/kormo_load.py
- Command line
-
hf download hf://KORMo-VL/KORMo-Web-10B/kormo_load.py
-
curl -L -o kormo_load.py https://huggingface.co/KORMo-VL/KORMo-Web-10B/resolve/main/kormo_load.py
2.01 kB
| """Load KORMo-Web-10B with transformers 5. | |
| KORMo-Web-10B is a LLaVA-OneVision model (SigLIP vision tower + projector) with the KORMo-10B text model. | |
| transformers does not ship the KORMo text model, so two small steps are needed: | |
| import kormo_load | |
| kormo_load.register(MODEL_DIR) # 1. register the KORMo text model from this repo | |
| model = AutoModelForImageTextToText.from_pretrained(MODEL_DIR, dtype="bfloat16") | |
| kormo_load.patch_vision(model) # 2. use the post-layernorm SigLIP features, as in training | |
| """ | |
| from transformers import AutoConfig, AutoModel, AutoModelForCausalLM | |
| from transformers.dynamic_module_utils import get_class_from_dynamic_module | |
| def register(model_dir): | |
| """Register `kormo` (from `_configuration_kormo.py` / `_modeling_kormo.py` in `model_dir`) with the Auto classes.""" | |
| cfg = get_class_from_dynamic_module("_configuration_kormo.KORMoConfig", model_dir) | |
| base = get_class_from_dynamic_module("_modeling_kormo.KORMoModel", model_dir) | |
| lm = get_class_from_dynamic_module("_modeling_kormo.KORMoForCausalLM", model_dir) | |
| for fn in (lambda: AutoConfig.register("kormo", cfg), lambda: AutoModel.register(cfg, base), lambda: AutoModelForCausalLM.register(cfg, lm)): | |
| try: | |
| fn() | |
| except ValueError: # already registered | |
| pass | |
| def patch_vision(model): | |
| """The model was trained on SigLIP features *after* post_layernorm (transformers 4.57 behaviour). | |
| In transformers 5, hidden_states[-1] is the value *before* post_layernorm, so replace it with last_hidden_state. | |
| Call once after from_pretrained; without it the model still runs but misreads screenshots.""" | |
| vt = model.model.vision_tower if hasattr(model, "model") else model.vision_tower | |
| def hook(mod, args, out): | |
| if getattr(out, "hidden_states", None): | |
| out.hidden_states = tuple(out.hidden_states[:-1]) + (out.last_hidden_state,) | |
| return out | |
| vt.register_forward_hook(hook) | |
| return model | |