From bfeb10515d2f876105ec680d6a260708c2210265 Mon Sep 17 00:00:00 2001 From: Yuhao Wang Date: Thu, 12 May 2022 21:06:25 +0800 Subject: [PATCH] update version --- README_CN.md | 21 +++++--------------- examples/template/runners/runner_template.py | 14 +++++++------ examples/template/train.py | 17 ---------------- requirements.txt | 1 + 4 files changed, 14 insertions(+), 39 deletions(-) delete mode 100644 examples/template/train.py diff --git a/README_CN.md b/README_CN.md index cd9ea8a..cd69fbc 100644 --- a/README_CN.md +++ b/README_CN.md @@ -8,7 +8,7 @@ --- -Easytorch是一个基于PyTorch的开源神经网络训练框架,封装了PyTorch项目中常用的功能,帮助用户快速构建深度学习项目。 +EasyTorch是一个基于PyTorch的开源神经网络训练框架,封装了PyTorch项目中常用的功能,帮助用户快速构建深度学习项目。 ## 功能亮点 @@ -35,9 +35,7 @@ python >= 3.6 (推荐 >= 3.7) ### PyTorch及CUDA -[pytorch](https://pytorch.org/) >= 1.4(推荐 >= 1.7) - -[CUDA](https://developer.nvidia.com/zh-cn/cuda-toolkit) >= 9.2 (推荐 >= 11.0) +[pytorch](https://pytorch.org/) >= 1.4(推荐 >= 1.7),如需使用CUDA,安装PyTorch时选择对应CUDA版本编译的包。 注意:如需使用安培(Ampere)架构GPU,PyTorch版本需 >= 1.7且CUDA版本 >= 11.0。 @@ -51,23 +49,14 @@ pip install -r requirements.txt * [线性回归](examples/linear_regression) * [MNIST手写数字识别](examples/mnist) +* [ImageNet图像分类](examples/imagenet) ## 开始使用 -### 新建项目文件夹并初始化git仓库 - -```shell -mkdir my_deeplearning_project -cd my_deeplearning_project -git init -``` - -### 添加easytorch子仓库 +### 安装EasyTorch ```shell -git submodule add https://github.com/cnstark/easytorch.git -git add . -git commit -m "init by easytorch" +pip install easy-torch ``` ### 复制EasyTorch模板至工作目录 diff --git a/examples/template/runners/runner_template.py b/examples/template/runners/runner_template.py index f7b205f..05a7a34 100644 --- a/examples/template/runners/runner_template.py +++ b/examples/template/runners/runner_template.py @@ -1,3 +1,5 @@ +from typing import Dict + import torch from torch import nn from torch.utils.data import Dataset @@ -8,10 +10,10 @@ class RunnerTemplate(Runner): - def __init__(self, cfg: dict): + def __init__(self, cfg: Dict): super().__init__(cfg) - def init_training(self, cfg: dict): + def init_training(self, cfg: Dict): super().init_training(cfg) # init loss @@ -22,22 +24,22 @@ def init_training(self, cfg: dict): # register meters by calling: # self.register_epoch_meter('train_loss', 'train', '{:.2f}') - def init_validation(self, cfg: dict): + def init_validation(self, cfg: Dict): super().init_validation(cfg) # self.register_epoch_meter('val_acc', 'val', '{:.2f}%') @staticmethod - def define_model(cfg: dict) -> nn.Module: + def define_model(cfg: Dict) -> nn.Module: return MODEL_DICT[cfg['MODEL']['NAME']](**cfg['MODEL'].get('PARAM', {})) @staticmethod - def build_train_dataset(cfg: dict) -> Dataset: + def build_train_dataset(cfg: Dict) -> Dataset: # return your train Dataset pass @staticmethod - def build_val_dataset(cfg: dict): + def build_val_dataset(cfg: Dict): # return your val Dataset pass diff --git a/examples/template/train.py b/examples/template/train.py deleted file mode 100644 index 948b802..0000000 --- a/examples/template/train.py +++ /dev/null @@ -1,17 +0,0 @@ -from argparse import ArgumentParser - -from easytorch.easytorch import launch_training - - -def parse_args(): - parser = ArgumentParser(description='Welcome to EasyTorch!') - parser.add_argument('-c', '--cfg', help='training config', required=True) - parser.add_argument('--gpus', help='visible gpus', type=str) - parser.add_argument('--tf32', help='enable tf32 on Ampere device', action='store_true') - return parser.parse_args() - - -if __name__ == "__main__": - args = parse_args() - - launch_training(args.cfg, args.gpus, args.tf32) diff --git a/requirements.txt b/requirements.txt index 42747b4..9650486 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ torch>=1.7 +torchvision easydict tensorboard tqdm