鲲鹏社区首页
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

获取源码与源码补丁

从ONNX Runtime官方网站获取ONNX Runtime源码文件,从Gitee仓库获取ONNX Runtime的算子优化补丁文件。

获取ONNX Runtime源码

  1. 进入“/path/to/ONNX_Runtime”目录。
    1
    cd /path/to/ONNX_Runtime
    
  2. 配置Git网络代理。
    1
    2
    3
    git config --global http.sslVerify false
    git config --global https.sslVerify false
    git config --global http.proxy "http://用户名:密码@代理IP地址:代理端口"
    
  3. 请参见表2获取ONNX Runtime源码。

    若服务器可以访问网络,则可以直接在服务器上使用wget命令下载源码。

    cd /path/to/ONNX_Runtime
    wget https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.19.2.zip --no-check-certificate
  4. 将源码复制至服务器“/path/to/ONNX_Runtime”
  5. 解压ONNX Runtime安装包。
    1
    unzip v1.19.2.zip
    

    得到onnxruntime-1.19.2包。

  6. 进入“/path/to/ONNX_Runtime/onnxruntime-1.19.2”目录。
    cd /path/to/ONNX_Runtime/onnxruntime-1.19.2
  7. 安装Python依赖。
    1
    pip install -r requirements.txt --user
    

    安装过程中若出现如下问题,则设置镜像源安装。

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

获取并合入源码补丁

  1. 获取ONNX Runtime的补丁文件。
    1. 请参见表2下载ONNX Runtime补丁文件konnx.patch。
    2. 将补丁文件konnx.patch上传至服务器“/path/to/ONNX_Runtime”目录下。
  2. 进入“/path/to/ONNX_Runtime/onnxruntime-1.19.2”目录。
    1
    cd /path/to/ONNX_Runtime/onnxruntime-1.19.2
    
  3. 初始化仓库。
    1
    2
    3
    git init
    git add .
    git commit -m "code init"
    
  4. 合入konnx.patch补丁文件到仓库中。
    1
    git apply ../konnx.patch
    
  5. 查看是否有如下图所示文件内容更改,若有,则合入补丁成功。
    1
    2
    git add .
    git status