English
Content on This Page

Installation

Software Version Mapping

The following table describes the version mapping of openMind Library v1.0.0. Only the Linux OS is supported.

NameVersionLink
MindSpore2.4.0https://www.mindspore.cn/versions#2.4.0
PyTorch2.1.0https://download.pytorch.org/whl/torch/
PyTorch-NPU6.0.rc3-pytorch2.1.0https://gitee.com/ascend/pytorch/releases/tag/v6.0.rc3-pytorch2.1.0
CANN8.0.RC3.beta1https://www.hiascend.com/developer/download/community/result?module=cann&cann=8.0.RC3.beta1
HDK1.0.26.alphahttps://www.hiascend.com/hardware/firmware-drivers/community?product=6&model=27&cann=8.0.RC3.alpha003&driver=1.0.26.alpha
HDK (RC3, optional)1.0.27.alphahttps://www.hiascend.com/hardware/firmware-drivers/community?product=4&model=26&cann=8.0.RC3.beta1&driver=1.0.27.alpha
MindSpeed (optional)1.0.RC2https://gitee.com/ascend/MindSpeed/tree/1.0.RC2/
Megatron (optional)0.6.0https://github.com/NVIDIA/Megatron-LM/releases/tag/core_v0.6.0
Mindnlp(optional)0.4.1https://github.com/mindspore-lab/mindnlp
diffusers(optional)0.27.0https://github.com/huggingface/diffusers/tree/v0.27.0
silicondiff_npu(optional)2.1.0https://pypi.org/project/silicondiff-npu/2.1.0/

Installation Guide

Only Ascend NPUs are supported, so the following operations are performed in the NPU environment.

(Optional) Step 1: Installing the Driver and Firmware

  • For initial installation, install the driver and then the firmware.

    Initial installation scenario: The driver is not installed in the initial environment. The NPU information cannot be queried in the npu-smi or the driver module cannot be queried in the lsmod | grep drv.

  • In the upgrade scenario, install the firmware and then the matching driver.

    Upgrade scenario: The driver has been installed in the initial environment, and the device information can be queried using the npu-smi command.

The following uses the upgrade scenario as an example to describe how to install the HDK.

bash
bash Ascend-hdk-<soc_version>-npu-firmware_*.run --full
bash Ascend-hdk-<soc_version>-npu-driver_*.run --full

reboot

For details, see Installing Drivers and Firmware.

(Optional) Step 2: Installing the CANN Package

If the installation is performed in the NPU environment, install the CANN package by referring to this section. Otherwise, skip this section.

The following describes how to install the CANN package in a specified path.

bash
#Create the installation directory.
mkdir -p /xxx/your_folder/cann/
chmod -R 755 /xxx/your_folder

#Install the CANN package.
bash Ascend-cann-toolkit_*_linux-*.run --install-path=/xxx/your_folder/cann/ --full
bash Ascend-cann-kernels-*_linux.run --install-path=/xxx/your_folder/cann/ --install

#Source the environment variables.
source /xxx/your_folder/cann/ascend-toolkit/set_env.sh

For details, see Installing CANN.

Step 3: Preparing Environment

Before installing the openMind Library, ensure that you have installed Python and the openMind Hub Client. The supported versions and installation description are as follows:

Step 4: Installing the Virtual Environment

To avoid compatibility issues between dependencies in different projects, Python and conda virtual environments are recommended. For details about how to install and manage the virtual environments, see Python virtual environment and conda virtual environment. This document only describes how to create and enable the virtual environments, taking Python 3.10 as an example:

  • Create and use a Python virtual environment.

    Note: The prerequisite for this installation mode is that Python 3.10 has been installed in the system.

    shell
    # Create a Python virtual environment named **your_venv_name**.
    python3 -m venv /path/to/your_venv_name
    # Activate the **your_venv_name** virtual environment.
    source /path/to/your_venv_name/bin/activate
    
  • Create and use a conda virtual environment.

    shell
    # Create a Python 3.10 virtual environment named **your_venv_name**.
    conda create -n your_venv_name python=3.10
    # Activate the **your_venv_name** virtual environment.
    conda activate your_venv_name
    

Conda is recommended for managing virtual environments because it can run on different platforms.

Step 5: Installing the openMind Library with pip

You can install openMind Library through pip. Select the corresponding command based on your environment.

Note that the torch on which the torch-npu depends can be directly installed through pip in aarch64. However, in x86, a specific url needs to be set to download the cpu version. Therefore, the installation commands in the two environments are different. The specific installation codes are described in the following sections.

  • If you want to install only openMind Library without any framework, use the upload and download functions of the Modelers community.

    shell
    pip install openmind
    
  • Install openMind Library, PyTorch, and the dependencies.

    shell
    #Installation in the AArch64 environment
    pip install openmind[pt]
    
    #Installation in the x86 environment
    pip install openmind[pt] --extra-index-url https://download.pytorch.org/whl/cpu        
    
  • Install openMind Library, MindSpore, and the dependencies.

    shell
    pip install openmind[ms]
    

Step 6: Verifying the Installation

After installing the openMind Library, run the following command to check whether the openMind Library is successfully installed:

shell
python -c "import openmind;print(openmind.__version__);"

This command prints the version number of the installed openMind Library, indicating that openMind Library is successfully installed. The following figure shows the command output after successful installation of openMind Library. The information varies from version to version.

Successful installation of openMind Library

Uninstallation

Use pip to uninstall the openMind Library package.

shell
pip uninstall openmind

Tips

Run the following command to get the installation or uninstallation log. LOG_FILE indicates the specified log path or log file name.

[Note] Installation and uninstallation logs are not dumped. Before the installation, ensure that there is enough drive space.

shell
# Get the openMind Library installation log.
pip install openmind --log LOG_FILE
shell
# Get the openMind Library uninstallation log.
pip uninstall openmind --log LOG_FILE