#192 update readme

Merged
Erpim merged 15 commits from zlq into master 1 year ago
  1. +16
    -1
      README.md

+ 16
- 1
README.md View File

@@ -14,7 +14,11 @@ MSAdapter可以使PyTorch的模型在昇腾(Ascend)上运行。
训练过程部分代码需要用户自定义编写。

## 安装
### 安装MindSpore
请根据MindSpore官网[安装指南](https://www.mindspore.cn/install),安装2.0.0及以上版本的MindSpore。


### 安装MSAdapter
#### 通过pip安装 (待版本发布后)
```bash
pip install ms_adapter
@@ -26,7 +30,10 @@ pip install ms_adapter
cd MSAdapter
python setup.py install
```

如果出现权限不足的提示,请按照如下方式安装:
```bash
python setup.py install --user || exit 1
```
## 使用
在构建模型上,MSAdapter可以和PyTorch一样使用,示例如下:
```python
@@ -54,3 +61,11 @@ net = MLP()

## 资源
- 模型库:MSAdapter支持丰富的深度学习应用,这里给出了从PyTorch官方代码迁移到MSAdapter模型。[已验证模型资源](https://git.openi.org.cn/OpenI/MSAdapterModelZoo)


## FAQ
Q:设置context.set_context(mode=context.GRAPH_MODE)后运行出现类似问题:`Tensor.add_` is an in-place operation and "x.add_()" is not encouraged to use in MindSpore static graph mode. Please use "x = x.add()" or other API instead。<br/>
A:目前在设置GRAPH模式下不支持原地操作相关的接口,需要按照提示信息进行修改。需要注意的是,即使在PYNATIVE模式下,原地操作相关接口也是不鼓励使用的,因为目前在MSAdapter不会带来内存收益,而且会给反向梯度计算带来不确定性。

Q:运行代码出现类似报错信息:AttributeError: module 'ms_adapter.pytorch' has no attribute 'xxx'。<br/>
A:首先确定'xxx'是否为torch 1.12版本支持的接口,PyTorch官网明确已废弃或者即将废弃的接口和参数,MSAdapter不会兼容支持,请使用其他同等功能的接口代替。如果是PyTorch对应版本支持,而MSAdapter中暂时没有,欢迎参与[MSAdapter项目](https://openi.pcl.ac.cn/OpenI/MSAdapter)贡献你的代码,也可以通过[创建任务(New issue)](https://openi.pcl.ac.cn/OpenI/MSAdapter/issues/new)反馈需求。

Loading…
Cancel
Save