forked from tensorlayer/TensorLayerX
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'oneflow_dev' of https://github.com/QuantumLiu/TensorLayerX
- Loading branch information
Showing
88 changed files
with
2,122 additions
and
2,100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.git | ||
.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
.DS_Store | ||
|
||
# C extensions | ||
*.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ formats: | |
|
||
python: | ||
version: 3.6 | ||
version: 3.7 | ||
|
||
requirements_file: | ||
requirements/requirements_doc.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,57 +14,91 @@ | |
[](https://pepy.tech/project/tensorlayerx/week) | ||
[](https://hub.docker.com/r/tensorlayer/tensorlayerx/) | ||
|
||
🇬🇧 TensorLayerX is a multi-backend AI framework, which supports TensorFlow, Pytorch, MindSpore, PaddlePaddle, OneFlow and Jittor as the backends, allowing users to run the code on different hardware like Nvidia-GPU and Huawei-Ascend. | ||
[TensorLayerX](https://tensorlayerx.readthedocs.io) is a multi-backend AI framework, supports TensorFlow, Pytorch, MindSpore, PaddlePaddle, OneFlow and Jittor as the backends, allowing users to run the code on different hardware like Nvidia-GPU, Huawei-Ascend, Cambricon and more. | ||
This project is maintained by researchers from Peking University, Imperial College London, Princeton, Stanford, Tsinghua, Edinburgh and Peng Cheng Lab. | ||
[supported layers](https://shimo.im/sheets/kJGCCTxXvqj99RGV/F5m5Z). | ||
|
||
🇨🇳 TensorLayerX 是一个跨平台开发框架,支持TensorFlow, Pytorch, MindSpore, PaddlePaddle, OneFlow和Jittor,用户不需要修改任何代码即可以运行在各类操作系统和AI硬件上(如Nvidia-GPU 和 Huawei-Ascend),并支持混合框架的开发。这个项目由北京大学、鹏城实验室、爱丁堡大学、帝国理工、清华、普林斯顿、斯坦福等机构的研究人员维护。 | ||
[支持列表](https://shimo.im/sheets/kJGCCTxXvqj99RGV/F5m5Z)。 | ||
|
||
GitHub: https://github.com/tensorlayer/TensorLayerX | ||
OpenI: https://openi.pcl.ac.cn/OpenI/TensorLayerX | ||
|
||
# Document | ||
TensorLayerX has extensive documentation for both beginners and professionals. | ||
|
||
[](https://tensorlayerx.readthedocs.io/en/latest/) | ||
|
||
# DeepLearning course | ||
🔥We have opened a video course for introductory learning deep learning, with example codes based on TensorLayerX. | ||
[Bilibili link](https://www.bilibili.com/video/BV1xB4y1h7V2?share_source=copy_web&vd_source=467c17f872fcde378494433520e19999) | ||
# Deep Learning course | ||
We have video courses for deep learning, with example codes based on TensorLayerX. | ||
[Bilibili link](https://www.bilibili.com/video/BV1xB4y1h7V2?share_source=copy_web&vd_source=467c17f872fcde378494433520e19999) (chinese) | ||
|
||
# Design Features | ||
|
||
Compare with [TensorLayer](https://github.com/tensorlayer/TensorLayer), [TensorLayerX](http://tensorlayerx.readthedocs.io)(TLX) is a brand new seperated project for platform-agnostic purpose. | ||
<p align="center"><img src="https://git.openi.org.cn/hanjr/tensorlayerx-image/raw/branch/master/version.png" width="840"\></p> | ||
|
||
Compare to TensorLayer version: | ||
- ***Compatibility***: Support worldwide frameworks and AI chips, enabling one code runs on all platforms. | ||
|
||
<p align="center"><img src="https://git.openi.org.cn/hanjr/tensorlayerx-image/raw/branch/master/version.png" width="840"\></p> | ||
- ***Model Zoo***: Provide a series of applications containing classic and SOTA models, covering CV, NLP, RL and other fields. | ||
|
||
- ***Deployment***: Support ONNX protocol, model export, import and deployment. | ||
|
||
# Multi-backend Design | ||
|
||
You can immediately use TensorLayerX to define a model via Pytorch-stype, and switch to any backends easily. | ||
|
||
```python | ||
import os | ||
os.environ['TL_BACKEND'] = 'tensorflow' # modify this line, switch to any backends easily! | ||
#os.environ['TL_BACKEND'] = 'mindspore' | ||
#os.environ['TL_BACKEND'] = 'paddle' | ||
#os.environ['TL_BACKEND'] = 'torch' | ||
import tensorlayerx as tlx | ||
from tensorlayerx.nn import Module | ||
from tensorlayerx.nn import Linear | ||
class CustomModel(Module): | ||
|
||
def __init__(self): | ||
super(CustomModel, self).__init__() | ||
|
||
self.linear1 = Linear(out_features=800, act=tlx.ReLU, in_features=784) | ||
self.linear2 = Linear(out_features=800, act=tlx.ReLU, in_features=800) | ||
self.linear3 = Linear(out_features=10, act=None, in_features=800) | ||
|
||
🔥TensorLayerX inherits the features of the previous verison, including ***Simplicity***, ***Flexibility*** and ***Zero-cost Abstraction***. ***Compare with [TensorLayer](https://github.com/tensorlayer/TensorLayer), TensorLayerX supports more backends, such as TensorFlow, MindSpore, PaddlePaddle and PyTorch. It allows users to run the same code on different hardwares like Nvidia-GPU and Huawei-Ascend.*** In addition, more features are ***under development***. | ||
def forward(self, x, foo=False): | ||
z = self.linear1(x) | ||
z = self.linear2(z) | ||
out = self.linear3(z) | ||
if foo: | ||
out = tlx.softmax(out) | ||
return out | ||
|
||
- ***Model Zoo***: Build a series of model Zoos containing classic and sota models,covering CV, NLP, RL and other fields. | ||
MLP = CustomModel() | ||
MLP.set_eval() | ||
``` | ||
|
||
- ***Deploy***: In feature, TensorLayerX will support the ONNX protocol, supporting model export, import and deployment. | ||
|
||
- ***Parallel***: In order to improve the efficiency of neural network model training, parallel computing is indispensable. | ||
|
||
# Resources | ||
|
||
- [TLX2ONNX](https://github.com/tensorlayer/TLX2ONNX/) ONNX Model Exporter for TensorLayerX. ✅ | ||
- [Examples](https://github.com/tensorlayer/TensorLayerX/tree/main/examples) for tutorials✅ | ||
- [GammaGL](https://github.com/BUPT-GAMMA/GammaGL) is a multi-backend graph learning library based on TensorLayerX.✅ | ||
- OpenIVA an easy-to-use product-level deployment framework✅ | ||
- [TLXZoo](https://github.com/tensorlayer/TLXZoo) pretrained models/backbones🚧 | ||
- TLXCV a bunch of Computer Vision applications🚧 | ||
- TLXNLP a bunch of Natural Language Processing applications🚧 | ||
- TLXRL a bunch of Reinforcement Learning applications, check [RLZoo](https://github.com/tensorlayer/RLzoo) for the old version✅ | ||
- [Examples](https://github.com/tensorlayer/TensorLayerX/tree/main/examples) for tutorials | ||
- [GammaGL](https://github.com/BUPT-GAMMA/GammaGL) is series of graph learning algorithm | ||
- [TLXZoo](https://github.com/tensorlayer/TLXZoo) a series of pretrained backbones | ||
- [TLXCV](https://github.com/tensorlayer/TLXCV) a series of Computer Vision applications | ||
- [TLXNLP](https://github.com/tensorlayer/TLXNLP) a series of Natural Language Processing applications | ||
- [TLX2ONNX](https://github.com/tensorlayer/TLX2ONNX/) ONNX model exporter for TensorLayerX. | ||
- [Paddle2TLX](https://github.com/tensorlayer/paddle2tlx) model code converter from PaddlePaddle to TensorLayerX. | ||
|
||
More resources can be found [here](https://github.com/tensorlayer) | ||
|
||
|
||
# Quick Start | ||
# Installation | ||
|
||
## Installation | ||
- The latest TensorLayerX compatible with the following backend version | ||
|
||
### Via docker | ||
| TensorLayerX | TensorFlow | MindSpore | PaddlePaddle|PyTorch| | ||
| :-----:| :----: | :----: |:-----:|:----:| | ||
| v0.5.8 | v2.4.0 | v1.8.1 | v2.2.0 | v1.10.0 | | ||
| v0.5.7 | v2.0.0 | v1.6.1 | v2.0.2 | v1.10.0 | | ||
|
||
- Via docker | ||
|
||
Docker is an open source application container engine. In the [TensorLayerX Docker Repository](https://hub.docker.com/repository/docker/tensorlayer/tensorlayerx), | ||
different versions of TensorLayerX have been installed in docker images. | ||
|
@@ -74,56 +108,35 @@ different versions of TensorLayerX have been installed in docker images. | |
docker pull tensorlayer/tensorlayerx:tagname | ||
``` | ||
|
||
|
||
### Via pip | ||
- Via pip for the stable version | ||
```bash | ||
# install from pypi | ||
pip3 install tensorlayerx | ||
``` | ||
|
||
### Build from source | ||
- Build from source for the latest version | ||
```bash | ||
# install from Github | ||
pip3 install git+https://github.com/tensorlayer/tensorlayerx.git | ||
``` | ||
For more installation instructions, please refer to [Installtion](https://tensorlayerx.readthedocs.io/en/latest/user/installation.html) | ||
|
||
## Define a model | ||
|
||
You can immediately use tensorlayerx to define a model, using your favourite framework in the background, like so: | ||
```python | ||
import os | ||
os.environ['TL_BACKEND'] = 'tensorflow' # modify this line, switch to any framework easily! | ||
#os.environ['TL_BACKEND'] = 'mindspore' | ||
#os.environ['TL_BACKEND'] = 'paddle' | ||
#os.environ['TL_BACKEND'] = 'torch' | ||
import tensorlayerx as tlx | ||
from tensorlayerx.nn import Module | ||
from tensorlayerx.nn import Linear | ||
class CustomModel(Module): | ||
# Contributing | ||
Join our community as a code contributor, find out more in our [Help wanted list](https://github.com/tensorlayer/TensorLayerX/issues/5) and [Contributing](https://tensorlayerx.readthedocs.io/en/latest/user/contributing.html) guide! | ||
|
||
def __init__(self): | ||
super(CustomModel, self).__init__() | ||
|
||
self.linear1 = Linear(out_features=800, act=tlx.ReLU, in_features=784) | ||
self.linear2 = Linear(out_features=800, act=tlx.ReLU, in_features=800) | ||
self.linear3 = Linear(out_features=10, act=None, in_features=800) | ||
# Getting Involved | ||
|
||
def forward(self, x, foo=False): | ||
z = self.linear1(x) | ||
z = self.linear2(z) | ||
out = self.linear3(z) | ||
if foo: | ||
out = tlx.softmax(out) | ||
return out | ||
We suggest users to report bugs using Github issues. Users can also discuss how to use TensorLayerX in the following slack channel. | ||
|
||
MLP = CustomModel() | ||
MLP.set_eval() | ||
``` | ||
|
||
# Contributing | ||
Join our community as a code contributor, find out more in our [Help wanted list](https://github.com/tensorlayer/TensorLayerX/issues/5) and [Contributing](https://tensorlayerx.readthedocs.io/en/latest/user/contributing.html) guide! | ||
<br/> | ||
|
||
<a href="https://join.slack.com/t/tensorlayer/shared_invite/enQtODk1NTQ5NTY1OTM5LTQyMGZhN2UzZDBhM2I3YjYzZDBkNGExYzcyZDNmOGQzNmYzNjc3ZjE3MzhiMjlkMmNiMmM3Nzc4ZDY2YmNkMTY" target="\_blank"> | ||
<div align="center"> | ||
<img src="https://github.com/tensorlayer/TensorLayer/blob/bdc2c14ff9ed9bd3ec7004d625e15683df7b530d/img/join_slack.png?raw=true" width="40%"/> | ||
</div> | ||
</a> | ||
|
||
# Contact | ||
- [email protected] | ||
|
@@ -133,14 +146,6 @@ Join our community as a code contributor, find out more in our [Help wanted list | |
If you find TensorLayerX useful for your project, please cite the following papers: | ||
|
||
``` | ||
@article{tensorlayer2017, | ||
author = {Dong, Hao and Supratak, Akara and Mai, Luo and Liu, Fangde and Oehmichen, Axel and Yu, Simiao and Guo, Yike}, | ||
journal = {ACM Multimedia}, | ||
title = {{TensorLayer: A Versatile Library for Efficient Deep Learning Development}}, | ||
url = {http://tensorlayer.org}, | ||
year = {2017} | ||
} | ||
@inproceedings{tensorlayer2021, | ||
title={TensorLayer 3.0: A Deep Learning Library Compatible With Multiple Backends}, | ||
author={Lai, Cheng and Han, Jiarong and Dong, Hao}, | ||
|
@@ -149,6 +154,13 @@ If you find TensorLayerX useful for your project, please cite the following pape | |
year={2021}, | ||
organization={IEEE} | ||
} | ||
@article{tensorlayer2017, | ||
author = {Dong, Hao and Supratak, Akara and Mai, Luo and Liu, Fangde and Oehmichen, Axel and Yu, Simiao and Guo, Yike}, | ||
journal = {ACM Multimedia}, | ||
title = {{TensorLayer: A Versatile Library for Efficient Deep Learning Development}}, | ||
url = {http://tensorlayer.org}, | ||
year = {2017} | ||
} | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
docker pull hadolint/hadolint:latest | ||
docker run --rm -i hadolint/hadolint hadolint --ignore DL3007 - < Dockerfile | ||
docker pull tensorlayer/tensorlayerx:tagname | ||
docker run --rm -i tensorlayer/tensorlayerx hadolint --ignore DL3007 - < Dockerfile | ||
|
||
PAUSE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.