Image-Text-to-Text
MLX
Safetensors
English
Japanese
llmjpvl
conversational
custom_code
4-bit precision
Instructions to use mlx-community/llm-jp-4-vl-9b-mlx-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/llm-jp-4-vl-9b-mlx-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("mlx-community/llm-jp-4-vl-9b-mlx-4bit") config = load_config("mlx-community/llm-jp-4-vl-9b-mlx-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
| # -------------------------------------------------------- | |
| # LLM-jp-VL | |
| # Copyright (c) 2026 LLM-jp | |
| # Licensed under The Apache License 2.0 [see LICENSE for details] | |
| # | |
| # Originally based on InternVL | |
| # Copyright (c) 2024 OpenGVLab | |
| # Licensed under The MIT License [see LICENSE for details] | |
| # -------------------------------------------------------- | |
| IMG_CONTEXT_TOKEN = "<|image_pad|>" | |
| HARMONY_START = "<|start|>" | |
| HARMONY_END = "<|end|>" | |
| HARMONY_MESSAGE = "<|message|>" | |
| HARMONY_CHANNEL = "<|channel|>" | |
| HARMONY_RETURN = "<|return|>" | |
| IMAGE_START = "<|image_start|>" | |
| IMAGE_END = "<|image_end|>" | |
| # System message following the official llm-jp/llm-jp-4-8b-thinking (Harmony) | |
| # format. Keep build_system_message() in sync with LLMJP4_HARMONY_CHAT_TEMPLATE | |
| # in prepare_llmjpvl.py (tests/test_chat_template.py checks they agree). | |
| MODEL_IDENTITY = "You are LLM-jp-VL, a Multimodal LLM trained by LLM-jp." | |
| KNOWLEDGE_CUTOFF = "2025-12" | |
| DEFAULT_REASONING_EFFORT = "medium" | |
| # Reasoning effort is conditioned on the CoT length of the (rendered) last turn, | |
| # so the model learns to associate a higher effort with a larger thinking | |
| # budget. Without conditioning, think/non-think samples share one effort and | |
| # give a conflicting signal (the model then just skips analysis). Harmony has | |
| # three levels: no CoT -> low; short CoT -> medium; long CoT (>= threshold, | |
| # absolute so it holds across datasets with longer reasoning) -> high. | |
| EFFORT_WITHOUT_THINK = "low" | |
| THINK_EFFORT_TOKEN_THRESHOLD = 100 # think tokens >= threshold -> high, else medium | |
| def effort_for_think_tokens(num_think_tokens: int) -> str: | |
| """Map a turn's CoT length to a Harmony reasoning-effort level.""" | |
| if num_think_tokens <= 0: | |
| return EFFORT_WITHOUT_THINK | |
| return "high" if num_think_tokens >= THINK_EFFORT_TOKEN_THRESHOLD else "medium" | |
| # Reasoning effort is conditioned on whether the training sample carries CoT, so | |
| # the model learns to associate the effort level with (not) emitting an analysis | |
| # channel. Without this, think/non-think samples share one effort and give a | |
| # conflicting signal (the model then just skips analysis). | |
| EFFORT_WITH_THINK = "high" | |
| EFFORT_WITHOUT_THINK = "low" | |
| VALID_CHANNELS_LINE = ( | |
| "# Valid channels: analysis, commentary, final." | |
| " Channel must be included for every message." | |
| ) | |
| def build_system_message( | |
| model_identity: str = MODEL_IDENTITY, | |
| knowledge_cutoff: str = KNOWLEDGE_CUTOFF, | |
| reasoning_effort: str = DEFAULT_REASONING_EFFORT, | |
| ) -> str: | |
| # Unlike the official template, no "Current date:" line — a live date | |
| # would make training samples and evaluation prompts non-reproducible. | |
| return ( | |
| f"{model_identity}\n" | |
| f"Knowledge cutoff: {knowledge_cutoff}\n\n" | |
| f"Reasoning: {reasoning_effort}\n\n" | |
| f"{VALID_CHANNELS_LINE}" | |
| ) | |