[GH-ISSUE #2011] Parameters loaded from Modelfile are cast to int in /show parameters #63201

Closed
opened 2026-05-03 12:32:16 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @nathanpbell on GitHub (Jan 16, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2011

It appears if I set float value parameters in the Modelfile, when I run that model and run /show parameters those floats get cast to ints.

Steps to reproduce

Create a Modelfile:

FROM mistral:text
PARAMETER num_ctx 32000
PARAMETER seed 42
PARAMETER num_predict 128
PARAMETER temperature 0.7
PARAMETER top_p 0.9

Create the model:

ollama create mymodel -f Modelfile

Run the model:

ollama run mymodel

Ask for the parameters:

>>> /show parameters
Model defined parameters:
seed                           42
temperature                    1
top_p                          1
num_ctx                        32000
num_predict                    128

You'll see that "top_p" and "temperature" have been rounded to integer value 1.

Originally created by @nathanpbell on GitHub (Jan 16, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2011 It appears if I set float value parameters in the Modelfile, when I run that model and run `/show parameters` those floats get cast to ints. ### Steps to reproduce Create a Modelfile: ``` FROM mistral:text PARAMETER num_ctx 32000 PARAMETER seed 42 PARAMETER num_predict 128 PARAMETER temperature 0.7 PARAMETER top_p 0.9 ``` Create the model: ``` ollama create mymodel -f Modelfile ``` Run the model: ``` ollama run mymodel ``` Ask for the parameters: ``` >>> /show parameters Model defined parameters: seed 42 temperature 1 top_p 1 num_ctx 32000 num_predict 128 ``` You'll see that "top_p" and "temperature" have been rounded to integer value `1`.
GiteaMirror added the bug label 2026-05-03 12:32:16 -05:00
Author
Owner

@nathanpbell commented on GitHub (Jan 16, 2024):

While in the ollama REPL, I can set float values:

>>> /set parameter temperature 0.8
Set parameter 'temperature' to '0.8'
>>> /show parameters
User defined parameters:
temperature                    0.8

Model defined parameters:
num_predict                    128
seed                           42
temperature                    1
top_p                          1
num_ctx                        32000
<!-- gh-comment-id:1893156163 --> @nathanpbell commented on GitHub (Jan 16, 2024): While in the ollama REPL, I can set float values: ``` >>> /set parameter temperature 0.8 Set parameter 'temperature' to '0.8' >>> /show parameters User defined parameters: temperature 0.8 Model defined parameters: num_predict 128 seed 42 temperature 1 top_p 1 num_ctx 32000 ```
Author
Owner

@pdevine commented on GitHub (Jan 16, 2024):

I created #2017 which should fix the issue, and also adds a unit test. Thanks for reporting this @nathanpbell , and thanks for the fix @Robitx.

<!-- gh-comment-id:1894184239 --> @pdevine commented on GitHub (Jan 16, 2024): I created #2017 which should fix the issue, and also adds a unit test. Thanks for reporting this @nathanpbell , and thanks for the fix @Robitx.
Author
Owner

@pdevine commented on GitHub (Jan 16, 2024):

Should be fixed now.

<!-- gh-comment-id:1894307334 --> @pdevine commented on GitHub (Jan 16, 2024): Should be fixed now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#63201