Run DeepHermes 3 on Windows: Step by Step Installation Guide

DeepHermes 3 is a language model known for its reasoning capabilities, built from the Hermes 3 datamix with added reasoning data. It's designed to toggle on and off long chains of thought, making it versatile for various applications.

Running it locally on Windows allows you to harness its power without relying on cloud-based services.

Advantages of Running Locally

  • Privacy: Keep your data on your own machine.
  • Performance: Reduce latency by eliminating the need to send data to remote servers.
  • Customization: Tailor the model to your specific needs.
  • Offline Access: Use the model even without an internet connection.

Prerequisites

Before you begin, ensure your system meets the following requirements:

  • Operating System: Windows 10 or later
  • Hardware:
    • Sufficient RAM (at least 16GB, 32GB recommended)
    • A compatible GPU with enough VRAM (NVIDIA recommended)
    • Sufficient storage space for the model and dependencies
  • Software:
    • Python 3.8 or later
    • Git
    • CUDA Toolkit (if using GPU)
    • A suitable code editor (e.g., VSCode)

Step-by-Step Installation Guide

Step 1: Install Required Software

  1. Install Python:
    • Download the latest version of Python from the official website.
    • During installation, ensure you check the box that says "Add Python to PATH".
    • Verify the installation by opening a command prompt and typing python --version.
  2. Install Git:
    • Download Git from the official website.
    • Follow the installation instructions, keeping the default settings.
    • Verify the installation by opening a command prompt and typing git --version.
  3. Install CUDA Toolkit (if using GPU):
    • Check your NVIDIA GPU compatibility on the NVIDIA website.
    • Download the CUDA Toolkit that is compatible with your GPU.
    • Follow the installation instructions, ensuring that the necessary environment variables are set.
    • Verify the installation by opening a command prompt and typing nvcc --version.
  4. Install a Code Editor:
    • Download and install VSCode from the official website.
    • Install the Python extension for VSCode to enable syntax highlighting and other helpful features.

Step 2: Download the Necessary Files

    • Open a command prompt and navigate to the directory where you want to store the DeepHermes 3 files.
    • Run the following command to clone the repository:
  1. Download the Model:
    • Download the DeepHermes 3 model weights from the specified source.
    • Place the model file in the appropriate directory within the cloned repository.

Clone the Repository:

git clone [repository URL]
cd [repository directory]

Replace [repository URL] with the actual URL of the DeepHermes 3 repository and [repository directory] with the name of the directory.

Step 3: Install Dependencies

    • Navigate to the repository directory in the command prompt.
    • Create a virtual environment using the following command:
    • Activate the virtual environment using the following command:
    • Install the necessary Python packages using pip:

Install Required Packages:

pip install -r requirements.txt

This command reads the requirements.txt file in the repository and installs all listed packages.

Activate the Virtual Environment:

.\venv\Scripts\activate

Create a Virtual Environment:

python -m venv venv

Step 4: Configure the Model

  1. Modify Configuration Files:
    • Open the configuration files in a text editor.
    • Adjust the settings to match your hardware and preferences. Key settings include:
      • Model path
      • GPU usage
      • Batch size
      • Temperature
  2. Set Environment Variables:
    • Set any required environment variables in your system settings or within the virtual environment.

Step 5: Run the Model

    • Run the script to start the DeepHermes 3 server:
  1. Interact with the Model:
    • Use a client application or API to send requests to the server and receive responses from the model.

Start the Server:

python run_server.py

Detailed Instructions for Each Step

Step 1: Install Required Software (Detailed)

Python Installation

  1. Download: Go to the official Python website and download the latest stable version for Windows.
  2. Run Installer: Execute the downloaded .exe file.
  3. Important: During the installation, ensure you check the box labeled "Add Python to PATH". This allows you to run Python from any command prompt.
  4. Customize Installation (Optional): You can choose to customize the installation location. However, the default location is usually fine.
  5. Install: Click "Install Now" to begin the installation process.
  6. Verify Installation:
    • Open a new command prompt.
    • Type python --version and press Enter.
    • If Python is installed correctly, it will display the Python version number.
    • Type pip --version and press Enter.
    • This command verifies that pip, the package installer for Python, is also installed.

Git Installation

  1. Download: Go to the official Git website and download the latest version for Windows.
  2. Run Installer: Execute the downloaded .exe file.
  3. Follow Instructions: Follow the installation instructions, keeping the default settings unless you have specific requirements.
  4. Adjust PATH Environment (Optional): The installer will ask how you want to use Git from the command line. The recommended option is "Git from the command line and also from 3rd-party software".
  5. Configure Line Ending Conversions: Choose how Git should handle line ending conversions. The recommended option is "Checkout Windows-style, commit Unix-style line endings".
  6. Install: Click "Install" to begin the installation process.
  7. Verify Installation:
    • Open a new command prompt.
    • Type git --version and press Enter.
    • If Git is installed correctly, it will display the Git version number.

CUDA Toolkit Installation (if using GPU)

  1. Check GPU Compatibility:
    • Visit the NVIDIA website to ensure your GPU is compatible with the CUDA Toolkit.
    • Note the compute capability of your GPU, as this may be required during installation.
  2. Download CUDA Toolkit:
    • Go to the NVIDIA CUDA Toolkit download page.
    • Select the appropriate version for your operating system.
    • Download the installer.
  3. Run Installer:
    • Execute the downloaded .exe file.
    • Follow the installation instructions. Choose the "Express" installation for a simplified setup.
    • The CUDA Toolkit installer should automatically set the necessary environment variables. If not, you may need to set them manually.
    • Open the System Properties dialog box (search for "environment variables" in the Start menu).
    • Click "Environment Variables".
    • Under "System variables", edit the "Path" variable to include the following paths:
  4. Verify Installation:
    • Open a new command prompt.
    • Type nvcc --version and press Enter.
    • If the CUDA Toolkit is installed correctly, it will display the CUDA version information.

Set Environment Variables:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v[version]\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v[version]\libnvvp

Replace [version] with the version number of the CUDA Toolkit you installed.

Code Editor Installation (VSCode)

  1. Download: Go to the official VSCode website and download the latest version for Windows.
  2. Run Installer: Execute the downloaded .exe file.
  3. Follow Instructions: Follow the installation instructions, keeping the default settings unless you have specific requirements.
  4. Install: Click "Install" to begin the installation process.
  5. Install Python Extension:
    • Open VSCode.
    • Click on the Extensions icon in the Activity Bar (or press Ctrl+Shift+X).
    • Search for "Python" in the Extensions Marketplace.
    • Install the Microsoft Python extension.

Step 2: Download the Necessary Files (Detailed)

Clone the Repository

Open Command Prompt: Open a command prompt or PowerShell window.

Navigate to Repository Directory: Use the cd command to enter the newly created repository directory:

cd [repository directory]

Replace [repository directory] with the name of the repository directory.

Clone Repository: Run the following command to clone the repository:

git clone [repository URL]

Replace [repository URL] with the actual URL of the DeepHermes 3 repository.

Navigate to Directory: Use the cd command to navigate to the directory where you want to store the DeepHermes 3 files. For example:

cd C:\Users\[YourUsername]\Documents\

Replace [YourUsername] with your actual username.

Download the Model

  1. Obtain Model Weights: Download the DeepHermes 3 model weights from the specified source (e.g., a direct download link or a torrent).
  2. Place Model File: Place the model file in the appropriate directory within the cloned repository. The specific directory will depend on the repository structure, but it is often a subdirectory named models or weights.

Step 3: Install Dependencies (Detailed)

Create a Virtual Environment

  1. Navigate to Repository Directory: Ensure you are in the repository directory in the command prompt.
  2. Why Use a Virtual Environment?: A virtual environment isolates the project's dependencies from the system-wide Python installation, preventing conflicts with other projects.
  3. Create Virtual Environment: Run the following command to create a virtual environment:
python -m venv venv

This command creates a new directory named venv that contains the virtual environment.

Activate the Virtual Environment

  1. Verify Activation: Ensure the virtual environment is activated by checking that the command prompt is prefixed with the environment name (e.g., (venv)).
  2. Activate Script: Run the appropriate activation script for your operating system. In Windows, use the following command:
.\venv\Scripts\activate

This command activates the virtual environment, changing the command prompt to indicate that the environment is active (e.g., (venv) C:\path\to\repository>).

Install Required Packages

  1. Requirements File: The repository should contain a requirements.txt file that lists all the necessary Python packages.
  2. Resolve Issues: If you encounter any issues during installation, such as missing dependencies or conflicting versions, try the following:
    • Upgrade pip: pip install --upgrade pip
    • Install packages individually: pip install [package name]
    • Check package versions: Ensure the package versions specified in requirements.txt are compatible with your system.

Install Packages: Run the following command to install the packages:

pip install -r requirements.txt

This command reads the requirements.txt file and installs all listed packages and their dependencies.

Step 4: Configure the Model (Detailed)

Modify Configuration Files

  1. Locate Configuration Files: The location and format of the configuration files will vary depending on the specific DeepHermes 3 implementation. Look for files with names like config.json, settings.yaml, or parameters.txt.
  2. Open in Text Editor: Open the configuration files in a text editor like VSCode.
  3. Adjust Settings: Modify the settings to match your hardware and preferences. Common settings include:
    • Model Path: The path to the DeepHermes 3 model file.
    • GPU Usage: Whether to use the GPU for processing. If using the GPU, specify the GPU ID.
    • Batch Size: The number of inputs processed in parallel. Increase this value to improve performance, but be mindful of memory limitations.
    • Temperature: A parameter that controls the randomness of the model's output. Lower values result in more predictable output, while higher values result in more creative output.
  4. Save Changes: Save the changes to the configuration files.

Set Environment Variables

  1. Identify Required Variables: Check the DeepHermes 3 documentation or repository for any required environment variables.
    • Temporary (Command Prompt): Set environment variables temporarily for the current command prompt session using the set command:
    • Permanent (System Settings): Set environment variables permanently in the System Properties dialog box:
      • Open the System Properties dialog box (search for "environment variables" in the Start menu).
      • Click "Environment Variables".
      • Under "System variables", click "New" to create a new environment variable.
      • Enter the variable name and value.
      • Click "OK" to save the changes.
  2. Apply Changes: If you set environment variables permanently, you may need to restart your computer for the changes to take effect.
  3. Set Variables:
set VARIABLE_NAME=value

Step 5: Run the Model (Detailed)

Start the Server

  1. Navigate to Repository Directory: Ensure you are in the repository directory in the command prompt.
  2. Monitor Output: Monitor the output in the command prompt for any error messages or status updates.
  3. Run the Server Script: Run the script to start the DeepHermes 3 server. The specific command will depend on the repository structure, but it is often a Python script named run_server.py or main.py:
python run_server.py
  1. Activate Virtual Environment: Activate the virtual environment if it is not already active:
.\venv\Scripts\activate

Interact with the Model

  1. Client Application or API: Use a client application or API to send requests to the server and receive responses from the model. The specific method will depend on the DeepHermes 3 implementation.
  2. Interpret Output: Interpret the output from the model. The output format will depend on the specific DeepHermes 3 implementation.

Example (using curl): If the server exposes a REST API, you can use curl to send requests:

curl -X POST -H "Content-Type: application/json" -d '{"prompt": "Hello, DeepHermes 3!"}' http://localhost:5000/generate

Replace http://localhost:5000/generate with the actual URL of the server's API endpoint.

Troubleshooting

  • Dependency Issues: Ensure all dependencies are installed correctly and that there are no version conflicts.
  • CUDA Errors: Verify that the CUDA Toolkit is installed correctly and that your GPU is compatible.
  • Memory Errors: Reduce the batch size or use a smaller model if you are running out of memory.
  • Configuration Errors: Double-check the configuration files for any typos or incorrect settings.

Optimizing Performance

  • Use GPU: Utilize a compatible NVIDIA GPU to significantly improve performance.
  • Adjust Batch Size: Experiment with different batch sizes to find the optimal value for your hardware.
  • Quantization: Use quantized versions of the model to reduce memory usage and improve performance.
  • Hardware Acceleration: Explore other hardware acceleration techniques, such as using specialized AI accelerators.

Conclusion

Running DeepHermes 3 on Windows offers numerous advantages, including privacy, performance, and customization. By following this comprehensive guide, you can successfully install and configure the model on your local machine and start harnessing its powerful language capabilities.

References

  1. Run DeepSeek Janus-Pro 7B on Mac: A Comprehensive Guide Using ComfyUI
  2. Run DeepSeek Janus-Pro 7B on Mac: Step-by-Step Guide
  3. Run DeepSeek Janus-Pro 7B on Windows: A Complete Installation Guide
  4. Deployment and Execution of DeepScaleR 1.5B on macOS