一、杭州人工智能服务器使用

1.使用JupyterLab访问服务器

服务器使用界面
左边为文件管理界面右边为命令行和代码编写界面

二、安装MindSpore

1.创建conda环境

conda激活环境失败问题
conda激活失败
服务器没有root权限,并且Ananconda配置不完善所以需要以下步骤:
1 首先终端输入 source activate
2 然后终端输入 source deactivate
3 输入你要激活的虚拟环境指令 conda activate your_virtual_name
就可以使用了,注意此时您创建的环境可能不在原来安装的anaconda 下面,而是在用户文件夹下的某个位置
然后使用conda create -n mindspore创建环境,并使用conda activate mindspore激活环境

2.安装MindSpore

MindSpore安装教程官网

3.安装MindSpore Reinforcement

使用pip命令安装GYMpip install gym -i https://pypi.tuna.tsinghua.edu.cn/simple
pip安装GYM报错

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
schedule-search 0.0.1 requires absl-py, which is not installed.
schedule-search 0.0.1 requires tensorflow>=1.10.0, which is not installed.
modelarts 1.2.3 requires esdk-obs-python<=3.21.4, but you have esdk-obs-python 3.21.8 which is incompatible.
modelarts 1.2.3 requires lxml>=4.6.3, but you have lxml 4.4.2 which   +

incompatible.
ma-cau 1.1.1 requires requests==2.26.0, but you have requests 2.23.0 which is incompatible.
ma-cau 1.1.1 requires tenacity<=6.1.0, but you have tenacity 8.0.1 which is incompatible.

重新安装不适配包

#卸载不适配包
pip uninstall esdk-obs-python
pip uninstall lxml
pip uninstall requests
pip uninstall tenacity
#重新安装不适配包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " esdk-obs-python<=3.21.4"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " lxml>=4.6.3"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " requests==2.26.0"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " tenacity<=6.1.0"
#安装需要安装的包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  " tensorflow>1.10.0"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  " absl-py"

tensorflow 使用相关问题

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 1.15.0 requires gast==0.2.2, but you have gast 0.5.2 which is incompatible.
modelarts 1.2.3 requires lxml>=4.6.3, but you have lxml 4.4.2 which is incompatible.
modelarts 1.2.3 requires tqdm>=4.61.0, but you have tqdm 4.46.1 which is incompatible.
ma-cau 1.1.1 requires requests==2.26.0, but you have requests 2.22.0 which is incompatible.

重新安装不适配包

#卸载不适配包
pip uninstall gast
pip uninstall lxml
pip uninstall tqdm
pip uninstall requests
#重新安装不适配包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " gast==0.2.2"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " lxml>=4.6.3"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " requests==2.26.0"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple " tqdm>=4.61.0"
#安装需要安装的包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  " tensorflow>1.10.0"
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  " absl-py"

三、服务器相关使用

服务器下载连接防火墙问题

Please use one of following command to start the specifed framework environment.

#for MindSpore
source /home/ma-user/anaconda3/bin/activate MindSpore
#for TensorFlow-1.15.0
source /home/ma-user/anaconda3/bin/activate TensorFlow-1.15.0
#cann地址
/home/ma-user/Ascend/ascend-toolkit
#操作系统版本
cat /etc/issue

CANN和CUDA类似
CANN安装指南

MindStudio类似于pycharm
MindStudio安装指南

Traceback (most recent call last):
  File "run_CartPole.py", line 37, in <module>
    action = RL.choose_action(observation)
  File "/home/ma-user/work/Reinforcement-learning-with-tensorflow-master/contents/6_OpenAI_gym/RL_brain.py", line 125, in choose_action
    observation = observation[np.newaxis, :]
TypeError: tuple indices must be integers or slices, not tuple
Traceback (most recent call last):
  File "train.py", line 88, in <module>
    train()
  File "train.py", line 84, in train
    episode=episode, params=trainer_params)
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore_rl/core/session.py", line 48, in run
    trainer.train(episode)
  File "/home/ma-user/work/reinforcement-r0.1/example/dqn/dqn_trainer.py", line 49, in train
    self.init_training()
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 290, in staging_specialize
    out = _MindsporeFunctionExecutor(func, input_signature, process_obj)(*args)
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 78, in wrapper
    results = fn(*arg, **kwargs)
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 216, in __call__
    output = self._graph_executor(tuple(new_inputs), phase)
RuntimeError: mindspore/ccsrc/runtime/device/cpu/cpu_kernel_runtime.cc:473 Run] AttributeError: 'tuple' object has no attribute 'astype'
Logo

鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。

更多推荐