MooreThreads / torch_musa

torch_musa is an open source repository based on PyTorch, which can make full use of the super computing power of MooreThreads graphics cards.
Other
290 stars 17 forks source link

Docker中 import torch musa 报错:ImportError: Please try running Python from a different directory! #9

Open Jerry2623 opened 1 year ago

Jerry2623 commented 1 year ago

步骤:

  1. 安装好driver image
  2. sudo docker pull registry.mthreads.com/mcconline/musa-pytorch-dev-public:latest
  3. 安装了 依赖包 image
  4. 创建container sudo docker run -it \ --privileged \ --name=torch_musa_dev \ --env MTHREADS_VISIBLE_DEVICES=all \ registry.mthreads.com/mcconline/musa-pytorch-dev-public:latest \ /bin/bash
  5. 设置环境变量 image
  6. 使用脚本编译 cd torch_musa bash build.sh
  7. 编译完成后运行python,import torch 和 torch_musa image

报错:ImportError: Please try running Python from a different directory!

Jerry2623 commented 1 year ago

想请问一下配置过程中是不是漏了哪些步骤? 或者是哪个步骤配置的不正确导致这个问题?

lms-mt commented 1 year ago

@Jerry2623 可以参考下我们提供个dev镜像:https://mcconline.mthreads.com/repo/musa-pytorch-dev-public?repoName=musa-pytorch-dev-public&repoNamespace=mcconline&displayName=MUSA%20Pytorch%20Dev%20Public 目前要求的驱动版本是2.1.1,看错误可能是驱动版本不一致造成的

caizhi-mt commented 1 year ago

想请问一下配置过程中是不是漏了哪些步骤? 或者是哪个步骤配置的不正确导致这个问题?

https://new-developer.mthreads.com/sdk/download/musa?equipment=&os=&driverVersion=&version=
这个下载链接中,把压缩包解压后,可以看到一个musa_2.1.1-Ubuntu-dev_amd64.deb 的驱动,安装方式是: sudo dpkg -i musa***.deb sudo modprobe mtgpu 在docker里面再次import torch_musa测试一下

Jerry2623 commented 1 year ago

image 安装了2.1.1的驱动, 还是会遇到相同的问题 image

Jerry2623 commented 1 year ago

升了driver到2.1.1,import torch_musa还是会遇到同样的问题

lms-mt commented 1 year ago

image 安装了2.1.1的驱动, 还是会遇到相同的问题 image

已经没有符号缺失的错误了,这个原因可能是因为你在/homt/torch_musa这个目录下运行解释器了,你换个目录试试?

lms-mt commented 1 year ago

@Jerry2623

Jerry2623 commented 1 year ago

@lms-mt 换路径到/home, import torch_musa遇到另外的问题 image

lms-mt commented 1 year ago

@Jerry2623 错误码显示是InvalidDevice,有两种原因:1. device index设置出错 2. 驱动问题 你可以先在运行python解释器之前加一句MUSA_VISIBLE_DEVICES=0 试试? 我们会在S80上尝试复现。

Jerry2623 commented 1 year ago

MUSA_VISIBLE_DEVICES=0需要加到哪里呢?

yaowang-mt commented 1 year ago

MUSA_VISIBLE_DEVICES=0需要加到哪里呢?

作为正常的环境变量:MUSA_VISIBLE_DEVICES=0 python

Jerry2623 commented 1 year ago

image 还是会有报错

Jerry2623 commented 1 year ago

image export MUSA_VISIBLE_DEVICES=0 还是不行

lms-mt commented 1 year ago

突然想起来,你sudo mthreads-gmi -q 看下你的mt-bios版本?我跑的s80没问题,版本是2.0.9,之前的版本是可能会出问题。 @Jerry2623

Jerry2623 commented 1 year ago

image BIOS 版本是2.0.9 @lms-mt

xingjianchao commented 1 year ago

@Jerry2623 您好,可以加我微信我们详细对下么18601246811

Jerry2623 commented 1 year ago

image image host 上driver版本是2.1.1, container里面是 N/A, 请问这个会有问题吗?

xingjianchao commented 1 year ago

@yaowang-mt 老师瞅瞅

Jerry2623 commented 1 year ago

我看到torch_musa 版本是2.0.0, 和driver 2.1.1不匹配吗? image

Jerry2623 commented 1 year ago

我们想试一下image to image,请问到哪里去找这个脚本呢?还有利用 mthreads-smi 如何实时查看GPU占用呢? image

Jerry2623 commented 1 year ago

image

mtyuanhangzheng commented 1 year ago

Author

我们会在近期开源摩笔马良WebUI,里面会包含image to image的功能,到时候欢迎使用!

rebornwwp commented 3 months ago

最后解决了没呢? @Jerry2623

rhmaaa commented 3 months ago

直接pip install torchvison==0.15.1之后,再import torch_musa出现这个问题,请问怎么解决?