Error: invalid float value [hot] and Error: invalid int value [big]
come from ollama create when a PARAMETER line in the Modelfile
holds a word where a number belongs. The text in the square brackets is the value it could
not read; replace it with a number of the right kind and create the model again.
temperature takes a decimal number such as 0.2;
num_ctx takes a whole number such as 4096. A Modelfile with both
lines fixed, created with ollama create fix-ok -f Modelfile.ok, printed
success.
The error
FROM qwen2.5:0.5b
PARAMETER temperature hot
PS> ollama create fix-temp -f Modelfile.temp
Error: invalid float value [hot]
FROM qwen2.5:0.5b
PARAMETER num_ctx big
PS> ollama create fix-ctx -f Modelfile.ctx
Error: invalid int value [big]
Why it happens
Each Modelfile parameter has a type. The test shows two of them: temperature
is read as a float and num_ctx as an integer. The value after the name is
converted to that type when the model is created, and a word that does not convert stops
the command with exit code 1. The message names the type it
expected (float or int) and repeats the value in brackets, but
not the parameter name, so with several PARAMETER lines you find the culprit
by looking for the bracketed text.
The word float or int in the message narrows the search to the
lines of that type: a decimal parameter such as temperature, or a whole-number
one such as num_ctx. Fix that line and leave the rest of the file alone.
The fix
FROM qwen2.5:0.5b
PARAMETER temperature 0.2
PARAMETER num_ctx 4096
PS> ollama create fix-ok -f Modelfile.ok
success
PS> ollama show fix-ok --parameters
num_ctx 4096
temperature 0.2
ollama show <model> --parameters lists the values the new model carries, so it is
a quick way to confirm that the Modelfile was read the way you meant. Here it printed both
lines with the numbers from the file.
How it was reproduced
On Windows 11 in Windows PowerShell 5.1 with Ollama 0.40.16, against a separate test
server on 127.0.0.1:15190 with its own models folder and qwen2.5:0.5b as the
base model. Two two-line Modelfiles (FROM and one PARAMETER), one with temperature hot and one with
num_ctx big, were passed to ollama create; then a Modelfile with
0.2 and 4096 was created and checked with
ollama show --parameters.
Frequently asked
- What does 'invalid float value' mean in an Ollama Modelfile?
- A PARAMETER that takes a decimal number, such as temperature, was given text. The bracketed word in the message is the value that could not be read. Write a number such as 0.2.
- What does 'invalid int value' mean when running ollama create?
- A PARAMETER that takes a whole number, such as num_ctx, was given something else. Replace the bracketed value with an integer such as 4096.
- How do I check which parameters an Ollama model has?
- Run ollama show with the model name and --parameters. It prints each parameter and its value, for example num_ctx 4096 and temperature 0.2.
More decoded errors in the Fixes category. When the problem is the instruction name rather than its value, see Ollama Modelfile: 'command must be one of'.