Skip to content

Commit

Permalink
Add Modelfile with temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
guynich committed Feb 24, 2025
1 parent 025763a commit 783dc05
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Modelfile_r1_1.5b
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM deepseek-r1:1.5b

# set the temperature [higher is more creative, lower is more coherent]
PARAMETER temperature 0.5

# set the system message
SYSTEM """
Please reason step by step.
"""
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ installation.
- [A simple problem](#a-simple-problem)
- [Prompt history](#prompt-history)
- [Examples](#examples)
- [Temperature (experimental)](#temperature-experimental)
- [Benchmarking](#benchmarking)
- [1.5B model](#15b-model)
- [7B model](#7b-model)
Expand Down Expand Up @@ -246,6 +247,38 @@ rm -f .ollama/history

# Examples

## Temperature (experimental)

DeepSeek documentation recommends changing
[parameter `temperature`](https://api-docs.deepseek.com/quick_start/parameter_settings)
based on the use case. This documentation does not state if this guidance is
specific to the V3 model or the R1 model.

DeepSeek R1 model documentation also mentions setting the `temperature` in these
[usage recommendations](https://github.com/deepseek-ai/DeepSeek-R1#usage-recommendations).

To experiment with this parameter Ollama offers customization of a model using
[Modelfile documentation](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#ollama-model-file).
An example [Modelfile_r1_1.5b](/Modelfile_r1_1.5b) is provided in this repo
with a temperature parameter.

To run the customized model\ first create `r1`. The DeepSeek R-1 1.5B model
needs to be pulled first if not already done as before.
```console
ollama pull deepseek-r1:1.5b
ollama create r1 -f ./Modelfile_r1_1.5b
```

Then run the customized model `r1`.
```console
ollama run r1
```

I'm not sure I see a difference in the answers compared with running the
model `ollama run deepseek-r1:1.5b`. This Modelfile is provided for
experimentation and comments are welcome!
## Benchmarking
The speed of this model version on a computer can be quantified with counting
Expand Down Expand Up @@ -373,3 +406,4 @@ is printed in tokens per second including the session average rate. See
* [x] Print chat script session in a stream
* [x] Try larger size DeepSeek-R1 "7B" model (4.7GiB download) on the OrangePi 5 Plus.
* [x] Try [OrangePi 3B](http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-3B.html) single board computer (~50 USD retail with 4GB RAM) with microSD card.
* [x] Add Ollama Modefile with temperature.

0 comments on commit 783dc05

Please sign in to comment.