TransGAN代码复现—九天毕昇平台

TransGAN代码复现—九天毕昇平台,第1张

目录
  • 一、九天毕昇 *** 作简介
    • 1.1、进入控制台
    • 1.2、新建自己的实例
    • 1.3、进入实例
  • 二、复现TransGAN
    • 2.1、下载git代码
    • 2.2、配置环境
    • 2.3、开始训练
    • 2.4、开始测试
  • 福利

TransGAN是UT-Austin、加州大学、 IBM研究院的华人博士生构建了一个只使用纯 transformer 架构、完全没有卷积的 GAN,并将其命名为 TransGAN
论文地址:https://arxiv.org/abs/2102.07074
论文精读:论文精读 TransGAN
代码地址:https://github.com/VITA-Group/TransGAN

本篇博文是利用中国移动的九天毕昇平台复现TransGAN的博文。

一、九天毕昇 *** 作简介

首先介绍一下深度学习服务平台:“九天·毕昇”是中国移动开发的一款云服务平台,能够提供高效(最高显存32GB的V100)便捷(主要优点还是免费O(∩_∩)O)的算力。

点击链接注册即可免费赢取 2000 个算力豆(100 小时 V100 使用时长:https://jtedu.cmri.cn/web#/register?token=NTIxNWNkOWEtNjIxZi00ZTIyLThlZTItNDhiYWQ3ODRiMDhm

1.1、进入控制台

进入首页后,点击进入控制台:


进入后可以看到存储空间,算力豆(九天毕昇算时的计算单位)和自己建立过的实例。

1.2、新建自己的实例


点击左侧导航栏,进入模型训练,点击新建实例

命名自己的实例名称,然后选择数据集(平台提供了一些数据集,选用平台数据集会自动加载在data/public文件夹中,但是平台只有
部分数据集,没有的数据集需要自己在数据管理或者在运行实例时进行上传)选择资源套餐。

1.3、进入实例

进入实例后,我们可以看到,和colab比较类似,左侧是文件资源部分,右侧可以进行编辑,

我们点击左上角的蓝色加号,新建一个notebook或者console或者最下面的terminal(看个人喜好),如果点击的是pytorch1.x,则平台就自动为了加载了最基础的pytorch环境。

二、复现TransGAN 2.1、下载git代码

首先进入终端terminal,克隆代码:

git clone https://github.com/VITA-Group/TransGAN


成功克隆后,项目代码如下:

2.2、配置环境

进入TransGAN:cd TransGAN,

然后根据requirement.txt下载安装环境:

pip install -r requirements.txt

可能会出现的问题:
ERROR: conda 4.11.0 requires ruamel_yaml_conda>=0.11.14, which is not installed.
ERROR: tensorflow 2.4.0 has requirement absl-py~=0.10, but you’ll have absl-py 1.0.0 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement flatbuffers~=1.12.0, but you’ll have flatbuffers 2.0 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement gast==0.3.3, but you’ll have gast 0.5.3 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement grpcio~=1.32.0, but you’ll have grpcio 1.45.0 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement h5py~=2.10.0, but you’ll have h5py 3.6.0 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement numpy~=1.19.2, but you’ll have numpy 1.21.5 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement six~=1.15.0, but you’ll have six 1.16.0 which is incompatible.
ERROR: tensorflow 2.4.0 has requirement typing-extensions~=3.7.4, but you’ll have typing-extensions 4.1.1 which is incompatible.
解决方案:这个的意思是tensorflow 2.4版本和一些其他环境的版本不能匹配。
需要重新安装TensorFlow:
pip install tensorflow

2.3、开始训练

在TransGAN目录下,输入:

python exps/cifar_train.py

开始训练:

训练的时间比较长,可能需要2天或者更久,我们也可以下载已经训练好的checkpoint进行测试(请看2.4)。

2.4、开始测试

如果2.3没有训练或者完,下载 cifar checkpoint并将其放到文件夹中:

最后输入测试命令,开始测试:

python exp/cifar_test.py

可能遇见的问题:
ModuleNotFoundError: No module named ‘tensorflow._api’
解决方案1:
参考网上推测要在命令行装tensorflow-gpu,在命令行输入:
pip install --upgrade --ignore-installed tensorflow-gpu
解决方案2:
TensorFlow未安装成功,重新pip安装

福利

点赞、评论+收藏三连,可以私信我领取专属5000算力豆!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/919214.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-16
下一篇 2022-05-16

发表评论

登录后才能评论

评论列表(0条)

保存