Models¶
Models are placed in the project_root/models directory
Requirements¶
-
The model must be a raw OpenVINO IR model, containing an
openvino_model.xml. The name of the model is the name used to run it. For example if you haveproject_root/demo-model-int4/openvino_model.xml, you would useovi run demo-model-int4or use the menu to select it -
The model must not be named
BackorExit
Pulling models¶
One place you can pull models from is HF hub, pre-converted models in raw IR format are available under the OpenVINO Toolkit organization
Here is an example of downloading qwen2.5-coder-7B-Instruct-Int4
# If you do not already have huggingface-hub installed, install it, if you have it installed, make sure you have the latest version:
# pip install huggingface-hub
# Swap project_root for the path of the project root
cd {project_root}/models
# You may customize the directory name, remember this is the name that will be used for the model menu
hf download OpenVINO/Qwen2.5-Coder-7B-Instruct-int4-ov --local-dir qwen2.5-coder:7B-int4
Ultimately you can download the models from anywhere, as long as they are in OpenVINO IR format
Running models¶
The model can be run via any OpenVINO‑supported targets, such as CPU, NPU and GPU, target selection is explained in Device settings. The model can be run via the model menu or directly via the command line.
Warning
Attempting to run a model without an IR graph(openvino_model.xml) will throw an error.
Running via model menu¶
Open the model menu by either running ovi and selecting Launch a model or running ovi run
This will open a menu like the following:
↑/↓ navigate • ← back • enter launch • esc/q quit.
============================================================
▸ qwen2.5-coder:7B-int4
qwen2.5-coder-1.5B-int4
navigate the menu and hit enter on the model you would like to launch, you will then see the following:
Connected to raw model 'qwen2.5-coder:7B-int4'. Type '/exit' to quit.
Use ↑/↓ to browse recent prompts.
------------------------------------------------------------
>>>
You are now connected to your model!
Running directly¶
Alternatively you can simply run ovi run {model name}, where model name is the name of the directory of the model you want to run.
This achieves the same outcome as running via model menu
Modelfiles¶
Each model directory can contain a Modelfile used to configure the runtime device and generation parameters.
Syntax¶
- Lines beginning with
#are ignored. - Device lines use
DEVICE <target>. - System prompts use
SYSTEM <prompt>and support single-line strings, triple-quoted blocks, and heredocs. - Generation settings use
PARAMETER <name> <value>. - Aliases are accepted for compatibility, but the canonical names below are preferred.
- Values may be quoted when needed, for example
PARAMETER stop_strings "END".
Example:
# Select the target device
DEVICE GPU
# System prompt
SYSTEM "You are a helpful coding assistant."
# Generation settings
PARAMETER max_new_tokens 256
PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER stop_strings "END"
PARAMETER stop_token_ids 12,13,99
Available parameters and aliases¶
The parser accepts the following canonical generation parameters:
max_new_tokenstemperaturetop_ktop_prepetition_penaltypresence_penaltyfrequency_penaltynum_beamsno_repeat_ngram_sizemax_lengthmin_new_tokensmax_ngram_sizemin_pdiversity_penaltylength_penaltyignore_eosechologprobsstop_stringsstop_token_ids
Aliases accepted by the parser:
temp->temperaturestop/stop_sequence/stop_sequences/stop_string->stop_stringsstop_token/stop_tokens->stop_token_idsnum_beam_groups/beam_width/beam_size->num_beamsno_repeat_ngram->no_repeat_ngram_sizemin_tokens->min_new_tokensngram_size->max_ngram_sizemin_probability->min_pdiversity->diversity_penaltylength->length_penaltyignore_end_of_sequence->ignore_eosecho_prompt->echolog_probabilities->logprobspresence->presence_penaltyfrequency->frequency_penalty
Device settings¶
DEVICE is a special Modelfile key. Supported values are:
CPUGPUNPUAUTO
If omitted, ovi defaults to CPU.
System prompt¶
The SYSTEM key sets the system prompt for the model. It can be specified as a string or using triple quotes for multi-line prompts.
Here are below examples of valid system prompts:
SYSTEM <<EOF
You are a helpful digital assistant.
Answer questions in a concise and clear manner.
EOF
Rules and validation¶
The parser enforces these rules when loading a Modelfile:
num_beamsmust be a positive integer between1and16.- If
num_beams > 1, beam search mode is enabled and the following values must be exactly0,0.0, or1.0as required: top_k = 0top_p = 0.0min_p = 0.0presence_penalty = 0.0frequency_penalty = 0.0diversity_penalty = 0.0repetition_penalty = 1.0temperature = 1.0max_ngram_size = 0length_penaltymust be non-negative.logprobsmust be an integer between0and10.max_lengthcannot be less thanmin_new_tokens.max_new_tokenscannot exceedmax_lengthwhen both are set.stop_token_idsmust be non-negative integers.- Unknown parameters are ignored.
- Known parameters with invalid values cause Modelfile validation to fail.
These rules are enforced to avoid invalid generation combinations; for example, beam search does not allow sampling penalties or sampling probabilities to be active at the same time.