AI训练没有GPU独显?教你使用魔搭免费提供的阿里云端 cuda GPU

魔搭 笔记本中,可免费使用阿里云提供的AI计算资源:100小时免费的GPU计算资源,长期免费的CPU计算资源。

提供资源的配置参数

1
2
3
CPU 8核
REM 32G
GPU 可选:无GPU、16G、32G

使用教程

  • 注册魔搭账号,关联阿里云账号

  • 打开我的Notebook

  • 选择计算环境(CPU/GPU),CPU 环境长期免费,GPU环境有100小时免费(启动后才计时,停止或后就不计时了)

  • 选择预装镜像,根据你需要的 cuda、torch、TensorFlow 版本来选择。

  • 点击“启动”按钮,等待一两分钟就启动好实例了

  • 点击“查看Notebook”就可以开始使用了。

  • 可以在笔记本中直接运行系统命令或python代码。如运行:!nvcc -V 查看 NVIDIA、CUDA 的版本信息。

  • 可以打开终端执行命令,比如运行ps -e fpython -V

评价

魔搭好的方面是:使用方便,注册登录账号就可以立即使用计算资源。
不好的地方主要是:

  • 实例关闭后,镜像数据会被清空。
  • 环境给予 Ubuntu,需要会一点 Linux 命令用起来才更熟练。

后续

魔搭给的免费GPU环境只有100个小时,关闭后数据还被清空,是不是不够用?接着看我们下一期《免费3个月的阿里云端 Cuda GPU 计算(使用教程)》。

SadTalker 安装笔记

环境

  • 阿里云PAI-DSW
  • ubuntu20.04
  • pytorch:1.12
  • gpu-cu113
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
git clone https://github.com/OpenTalker/SadTalker.git

cd SadTalker

conda create -n sadtalker python=3.8

conda activate sadtalker

conda info

# 把 pip 源设为腾讯源
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

# cpu 版
# pip --default-timeout=1000 install torch==1.12.1+cpu torchvision==0.13.1+cpu torchaudio==0.12.1 -f https://download.pytorch.org/whl/torch_stable.html

conda install ffmpeg

pip install -r requirements.txt

### Coqui TTS is optional for gradio demo.
### pip install TTS

# 下载模型

python inference.py
–driven_audio ../ds1.wav
–source_image ../2.jpg
–enhancer gfpgan
–preprocess full
–still

python inference.py –driven_audio test/ds1.wav –source_image test/1.jpg –enhancer gfpgan –cpu

3D 版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
git clone https://github.com/OpenTalker/SadTalker.git
cd SadTalker
conda create -n sadtalker3d python=3.8
source activate sadtalker3d

conda install ffmpeg
pip install fvcore iopath
conda install libgcc gmp

pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113

# insintall pytorch3d
pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1110/download.html

pip install -r requirements3d.txt

### install gpfgan for enhancer
pip install git+https://github.com/TencentARC/GFPGAN


### when occurs gcc version problem `from pytorch import _C` from pytorch3d, add the anaconda path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$YOUR_ANACONDA_PATH/lib/

python inference.py \
--driven_audio ../yiyi-tts.wav \
--source_image ../3.jpg \
--still \
--preprocess full \
--enhancer gfpgan