DEV Community

Cover image for Run DeepSeek R1 with Ollama on Windows - 100% Local Solution
JJ Dev
JJ Dev

Posted on

1

Run DeepSeek R1 with Ollama on Windows - 100% Local Solution

On January 20, 2025, DeepSeek released its first reasoning model, DeepSeek-R1, which demonstrates performance comparable to OpenAI’s o1 model in mathematics, coding, and reasoning tasks.

Its open-source nature allows developers to freely use, modify, and commercialize it, which has garnered significant attention within the AI community. Additionally, the model achieves high efficiency at a lower cost and also provides distillation technology, enabling the transfer of knowledge from larger models to smaller ones, thereby reducing computational resource requirements.

DeepSeek-R1 Local Deployment

1. Ollama

Download the Ollama software: Download Ollama, double-click to install.
Image description

You can use the following command to check if Ollama is installed successfully:

ollama --version
Enter fullscreen mode Exit fullscreen mode

2. Run the model

You can check the official website for the model and find the commands
Image description

A model with 1.5B (1.5 billion) parameters is considered a relatively smaller-scale LLM compared to larger models like 7B, 13B, or 65B parameters, which require significantly more computational resources.

Using a 1.5B parameter model is often a trade-off between efficiency and performance, making it more suitable for environments with limited hardware while still maintaining reasonable accuracy and capabilities.

ollama run deepseek-r1:1.5b
Enter fullscreen mode Exit fullscreen mode

Image description

Now, we can try sending a message to the DeepSeek-local model.

>>> give me code about Python Program to Add Two Numbers

3. Result

When using DeepSeek-R1, the model generates not only answers but also intermediate steps that outline its logical reasoning.

<think>
Okay, the user asked for a Python program to add two numbers. I need to provide a clear and simple solution.

First, I'll start by defining two variables, a and b. Then, I'll prompt the user to input their values using the
input() function.

I should consider using float() to handle decimal inputs because some people might enter numbers with decimals.
That way, the addition is precise.

Next, I'll write the sum by adding a and b together and store it in a variable called total.

After calculating the sum, I'll display both original numbers and their sum. Using print() will make this easy for
the user to see.

I should also add an example so the user can test their own numbers. That way, they can see how the program works
when they run it.
</think>
Enter fullscreen mode Exit fullscreen mode

Here's a simple Python program that adds two numbers:

# Define the two numbers
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))

# Calculate the sum
total = a + b

# Display the result
print(f"The sum of {a} and {b} is {total}")
Enter fullscreen mode Exit fullscreen mode

Explanation:

  1. Define the numbers: The program first reads two numbers from the user using input() and converts them to floating-point numbers.
  2. Calculate the sum: It adds the two numbers together and stores the result in a variable called total.
  3. Display the result: Finally, it prints out the sum with a formatted string that includes both original numbers.

You can run this program by copying the code into a Python file and executing it using a text editor or the Python
command line.

4. Evaluation

The code generation is correct, with a total response time of 26 seconds.

CPU

Model: AMD Ryzen 7 3700X 8-Core Processor
Cores: 8 cores / 16 threads
Base Clock: 3.59 GHz

Memory

Capacity: 16GB

Image description

5. Stop the model

# List running models
ollama ps
Enter fullscreen mode Exit fullscreen mode
# Stop a running model
ollama stop deepseek-r1:1.5b
Enter fullscreen mode Exit fullscreen mode

Image description

❤️‍🔥 Thank you for reading my article. 🎉🎉

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay