Spaces:
Runtime error
Download docs/llm.md from QuantumGenAI/ErrorMitigation: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/spaces/QuantumGenAI/ErrorMitigation/resolve/main/docs/llm.md
- Command line
-
hf download hf://spaces/QuantumGenAI/ErrorMitigation/docs/llm.md
-
curl -L -o llm.md https://huggingface.co/spaces/QuantumGenAI/ErrorMitigation/resolve/main/docs/llm.md
How to Run Deepseek Locally
This guide explains how to run the Deepseek model locally using Ollama as your server. Follow these steps to set up and use the model.
Prerequisites
Ensure you have Ollama installed on your machine. If not, follow the installation instructions for Windows at:
Getting Started with Deepseek Model
Step 1: Pull the Deepseek Model
To use models in Ollama, start by downloading the desired model using the pull command. Open your terminal and run:
ollama pull <model>
Step 2: Run the Model
After downloading, you can start the model with the following command:
ollama run <model>
This command activates the model, allowing you to enter queries or instructions, and receive responses.
Step 3: Using the Model with OpenAI API Specifications
Ollama is now compatible with the OpenAI Chat Completions API. This allows you to use additional tooling and applications with Ollama locally. Here's how to set it up:
from openai import OpenAI
model_name = "<model name>"
# Initialize the OpenAI client
client = OpenAI(
base_url = 'http://localhost:11434/v1',
api_key='ollama', # This is required but unused
)
# Create chat completions
response = client.chat.completions.create(
model=model_name,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"},
{"role": "assistant", "content": "The LA Dodgers won in 2020."},
{"role": "user", "content": "Where was it played?"}
]
)
# Print the response
print(response.choices[0].message.content)
Step 4: Configuring WSL2 for Local Server Access
If you are using WSL2 and wish to access the Ollama server running on your Windows machine, you need to configure WSL2 with mirror mode to share localhost between WSL2 and Windows. For more details, see: