我要评分
获取效率
正确性
完整性
易理解

Obtaining the Source Code and Its Patch

Obtain the ONNX Runtime source code file from the ONNX Runtime official website and the ONNX Runtime operator optimization patch file from the Gitee repository.

Obtaining the ONNX Runtime Source Code

  1. Go to the /path/to/ONNX_Runtime directory.
    1
    cd /path/to/ONNX_Runtime
    
  2. Configure a network proxy for Git.
    1
    2
    3
    git config --global http.sslVerify false
    git config --global https.sslVerify false
    git config --global http.proxy "http://Username:Password@Proxy_IP_address:Proxy_port"
    
  3. Obtain the ONNX_Runtime source code by following instructions in Table 2.

    If the server is connected to the Internet, you can run the wget command on the server to download the source package.

    cd /path/to/ONNX_Runtime
    wget https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.19.2.zip --no-check-certificate
  4. Copy the source code to the /path/to/ONNX_Runtime directory on the server.
  5. Decompress the ONNX Runtime installation package.
    1
    unzip v1.19.2.zip
    

    The onnxruntime-1.19.2 package is obtained.

  6. Go to the /path/to/ONNX_Runtime/onnxruntime-1.19.2 directory.
    cd /path/to/ONNX_Runtime/onnxruntime-1.19.2
  7. Install Python dependencies.
    1
    pip install -r requirements.txt --user
    

    If the following issue occurs during the installation, set a mirror repository for installation.

    pip install -r requirements.txt --user -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com/pypi/simple/

Obtaining and Applying the Source Code Patch

  1. Obtain the patch file of ONNX Runtime.
    1. Download the ONNX Runtime patch file konnx.patch by following instructions in Table 2.
    2. Upload the konnx.patch patch file to the /path/to/ONNX_Runtime directory.
  2. Go to the /path/to/ONNX_Runtime directory.
    1
    cd /path/to/ONNX_Runtime/
    
  3. Rename onnxruntime-1.19.2 as sra_onnxruntime_adapter.
    mv onnxruntime-1.19.2 sra_onnxruntime_adapter
  4. Initialize the repository.
    1
    2
    3
    git init
    git add .
    git commit -m "code init"
    
  5. Apply the softmax.patch patch file to the repository.
    1
    git apply ../konnx.patch
    
  6. Check whether the files are modified as shown in the following figure. If yes, the patch is successfully installed.
    1
    2
    git add .
    git status