Pitorch
所属分类:人工智能/神经网络/深度学习
开发工具:Cuda
文件大小:0KB
下载次数:0
上传日期:2023-12-29 16:24:35
上 传 者:
sh-1993
说明: 本人设计的第一个人工智能框架,是人工智能类编程的最后一个项目。
(The first AI framewrok designed by myself, which is the final project of class Programming in Artificial Intelligence .)
文件列表:
assets/
lib/
pitorch/
report.md
# Pitorch
The first AI framewrok designed by myself, which is the final project of class "Programming in Artificial Intelligence"
## TODO :pencil2:
- [ ] Data preprocessing
- [ ] Accelerate training
## Code structure
The code is orgnized as follows:
```bash
├── data
│ └── MNIST
├── lib # C++ and Cuda code of pitorch
│ ├── cpu_func.h # functions working on cpu
│ ├── cpu_func.cc
│ ├── gpu_func.h # functions working on gpu
│ ├── gpu_func.cu
│ ├── Tensor.h # Tensor class
│ ├── Tensor.cu
│ ├── tensor_func.h # wrapped cpu/gpu functions for Tensor
│ ├── tensor_func.cu
│ ├── utils.h # utils for error detection
│ ├── pybind.cpp
│ └── setup.py # install the lib
│
├── pitorch # Python code of pitorch
│ ├── __init__.py
│ ├── basic_operator.py # basic elements for Computinng Graph
│ ├── Pisor.py # difination of Pisor and Operators
│ ├── autodiff.py # gradient back propagation
│ ├── optimizer.py # optimizer zone
│ ├── Unittest.py # validate C++/Cuda operators
│ ├── test_forward.py
│ ├── test_backward.py
│ ├── train_fc_net.py # train a fully connected network
│ ├── train_conv_net.py # train a convolution network
│ └── utils.py # some util function (not finished yet)
└── README.md
```
## Usage
### Installation
```bash
conda create -n pitorch python=3.9
conda activate pitorch
# install pytorch according to your cuda version.
# (We just use torch.utils.cpp_extension to conveniently bind cuda code to python, and not utilize torch to conduct any operation)
cd lib
python setup.py develop
```
### Running demo
You can start training on MNIST as follows.
```bash
cd pitorch
# train convolution network
python train_conv_net.py
# train fully connected network
python train_fc_net.py
```
On the bottom of training script, you can tweak hyper-parameters, select optimizers as well as change device.
Here is an example of training log:
近期下载者:
相关文件:
收藏者: