How to Install DeepSeek with Ollama? 264

小编 ·

How to Install DeepSeek with Ollama?

Ollama is a tool for deploying and managing large AI models locally. DeepSeek is a large language model independently developed by the AI company DeepSeek. Below is a step-by-step guide on how to install DeepSeek using Ollama.

How to Install DeepSeek with Ollama?

Ollama is a tool for locally deploying and managing AI large models. DeepSeek is a large language model independently developed by the artificial intelligence company DeepSeek. The following will guide you step by step on how to install DeepSeek using Ollama.

Step 1: Install Ollama (works on all systems)

Open your computer's command-line tool (Windows users use PowerShell, Mac/Linux use Terminal), then:

1. One-click install Ollama

Windows (right-click and run PowerShell as Administrator):

winget install ollama

Mac/Linux:

curl -fsSL https://ollama.com/install.sh | sh

After installation, enter the following command to test whether it was successful:

ollama --version

If you see a version number (e.g., ollama version 0.1.23), the installation was successful!

Step 2: Install the DeepSeek Model

Scenario 1: Officially supported (recommended!)

1. Open Ollama's model library website: https://ollama.ai/library

2. Type deepseek in the search box to see if there is an official model (e.g., deepseek-7b-chat)

3. If there is, run the following command directly (using deepseek-7b-chat as an example):

ollama run deepseek-7b-chat

Ollama will automatically download and start the model. Once finished, it will display the >>> input prompt — just type your question!

Scenario 2: Not officially supported (manual installation)

If there is no official DeepSeek model, you need to do it manually:

1. Download the model file

Visit Hugging Face: https://huggingface.co

Search for deepseek-7b-chat-gguf, and find a quantized version (e.g., Q4_K_M.gguf)

Download the model file in .gguf format (you may need to register for a Hugging Face account)

2. Create the configuration file

Create a new text file named Modelfile (no extension), with the following content:

FROM /your-path/deepseek-7b-chat.Q4_K_M.gguf  # Replace with your actual file path
PARAMETER temperature 0.7  # Controls response randomness (0=conservative, 1=creative)

3. Install the custom model

Run the following in the command line (pay attention to the file path):

ollama create deepseek -f /your-path/Modelfile  # Replace with the actual path to Modelfile

4. Run the model

ollama run deepseek

Step 3: Test the model

After installation, type a question directly in the command line to test:

>>> Write a Python function to compute the Fibonacci sequence

Wait a moment, and the model will generate code!

Common Issue Solutions

1. Model file not found

  • Check whether the file path is correct (it's recommended to place the file on your desktop; the path will look like /Users/your-username/Desktop/deepseek-7b-chat.Q4_K_M.gguf)

  • If you get a permission error, try adding sudo before the command (Mac/Linux)

2. Slow running speed

  • Make sure your computer has at least 8GB of RAM

  • Try a smaller quantized version (e.g., Q2_K or Q3_K)

3. Model not responding

  • Check whether your network is working properly (the first run requires internet access)

Restart the Ollama service:

ollama serve  # Keep this window open and run the model in another window

Tips

  • Press 【Ctrl+C】 to interrupt model generation

  • Type 【 /bye】 to exit the model

  • For more commands, run ollama --help

By following the above steps, you should be able to successfully install and run the DeepSeek large model. If you encounter any other issues during installation, you can refer to Ollama's official documentation or seek help from the relevant community.