提交 1e0088bd 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!572 optimize mindwizard network templates for r0.7

Merge pull request !572 from liangyongxiong/r0.7
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
## 介绍 ## 介绍
MindWizard是一款快速生成经典网络脚本的工具。工具根据用户选择,组合模型、超参、数据集等网络参数,自动生成目标网络脚本,生成的网络脚本可以在Ascend或GPU等环境上进行训练和推理 MindWizard是一款快速生成经典网络脚本的工具。工具根据用户选择,组合模型、超参、数据集等网络参数,自动生成目标网络脚本,生成的网络脚本可以在Ascend或GPU等环境上进行训练和评估
## 安装 ## 安装
...@@ -33,7 +33,7 @@ optional arguments: ...@@ -33,7 +33,7 @@ optional arguments:
2. 请选择数据集(MNIST / Cifar10 / ImageNet / ...) 2. 请选择数据集(MNIST / Cifar10 / ImageNet / ...)
生成脚本后,用户可执行训练和推理,详细介绍可参考网络脚本工程中的README。 生成脚本后,用户可执行训练和评估,详细介绍可参考网络脚本工程中的README。
## 网络脚本工程结构 ## 网络脚本工程结构
...@@ -42,14 +42,14 @@ project ...@@ -42,14 +42,14 @@ project
|- script |- script
| |- run_standalone_train.sh # 单卡训练脚本 | |- run_standalone_train.sh # 单卡训练脚本
| |- run_distribute_train.sh # 多卡训练脚本 | |- run_distribute_train.sh # 多卡训练脚本
| |- run_eval.sh # 推理脚本 | |- run_eval.sh # 评估脚本
| |- ... | |- ...
|- src |- src
| |- config.py # 参数配置 | |- config.py # 参数配置
| |- dataset.py # 数据集处理 | |- dataset.py # 数据集处理
| |- lenet.py/resent.py/... # 网络定义 | |- lenet.py/resent.py/... # 网络定义
| |- ... | |- ...
|- eval.py # 网络推理 |- eval.py # 网络评估
|- train.py # 网络训练 |- train.py # 网络训练
|- README.md |- README.md
``` ```
......
...@@ -45,6 +45,7 @@ class SourceFile: ...@@ -45,6 +45,7 @@ class SourceFile:
fp.write(self.content) fp.write(self.content)
try: try:
shutil.copymode(self.template_file_path, new_file_path) shutil.copymode(self.template_file_path, new_file_path)
os.chmod(new_file_path, stat.S_IRUSR | stat.S_IWUSR)
self.set_writeable(new_file_path) self.set_writeable(new_file_path)
if new_file_path.endswith('.sh'): if new_file_path.endswith('.sh'):
self.set_executable(new_file_path) self.set_executable(new_file_path)
......
...@@ -67,7 +67,6 @@ do ...@@ -67,7 +67,6 @@ do
rm -rf ./train_parallel$i rm -rf ./train_parallel$i
mkdir ./train_parallel$i mkdir ./train_parallel$i
cp ../*.py ./train_parallel$i cp ../*.py ./train_parallel$i
cp *.sh ./train_parallel$i
cp -r ../src ./train_parallel$i cp -r ../src ./train_parallel$i
cd ./train_parallel$i || exit cd ./train_parallel$i || exit
echo "start training for rank $RANK_ID, device $DEVICE_ID" echo "start training for rank $RANK_ID, device $DEVICE_ID"
......
...@@ -54,7 +54,6 @@ export RANK_SIZE=$DEVICE_NUM ...@@ -54,7 +54,6 @@ export RANK_SIZE=$DEVICE_NUM
rm -rf ./train_parallel rm -rf ./train_parallel
mkdir ./train_parallel mkdir ./train_parallel
cp ../*.py ./train_parallel cp ../*.py ./train_parallel
cp *.sh ./train_parallel
cp -r ../src ./train_parallel cp -r ../src ./train_parallel
cd ./train_parallel || exit cd ./train_parallel || exit
echo "start training" echo "start training"
......
...@@ -56,7 +56,6 @@ then ...@@ -56,7 +56,6 @@ then
fi fi
mkdir ./eval mkdir ./eval
cp ../*.py ./eval cp ../*.py ./eval
cp *.sh ./eval
cp -r ../src ./eval cp -r ../src ./eval
cd ./eval || exit cd ./eval || exit
env > env.log env > env.log
......
...@@ -57,7 +57,6 @@ then ...@@ -57,7 +57,6 @@ then
fi fi
mkdir ./eval mkdir ./eval
cp ../*.py ./eval cp ../*.py ./eval
cp *.sh ./eval
cp -r ../src ./eval cp -r ../src ./eval
cd ./eval || exit cd ./eval || exit
env > env.log env > env.log
......
...@@ -59,7 +59,6 @@ then ...@@ -59,7 +59,6 @@ then
fi fi
mkdir ./train mkdir ./train
cp ../*.py ./train cp ../*.py ./train
cp *.sh ./train
cp -r ../src ./train cp -r ../src ./train
cd ./train || exit cd ./train || exit
echo "start training for device $DEVICE_ID" echo "start training for device $DEVICE_ID"
......
...@@ -59,7 +59,6 @@ then ...@@ -59,7 +59,6 @@ then
fi fi
mkdir ./train mkdir ./train
cp ../*.py ./train cp ../*.py ./train
cp *.sh ./train
cp -r ../src ./train cp -r ../src ./train
cd ./train || exit cd ./train || exit
echo "start training" echo "start training"
......
...@@ -28,7 +28,7 @@ cfg = edict({ ...@@ -28,7 +28,7 @@ cfg = edict({
'lr': 0.002, 'lr': 0.002,
"momentum": 0.9, "momentum": 0.9,
{% elif optimizer=='SGD' %} {% elif optimizer=='SGD' %}
'lr': 0.1, 'lr': 0.01,
{% else %} {% else %}
'lr': 0.001, 'lr': 0.001,
{% endif %} {% endif %}
......
...@@ -68,7 +68,6 @@ do ...@@ -68,7 +68,6 @@ do
rm -rf ./train_parallel$i rm -rf ./train_parallel$i
mkdir ./train_parallel$i mkdir ./train_parallel$i
cp ../*.py ./train_parallel$i cp ../*.py ./train_parallel$i
cp *.sh ./train_parallel$i
cp -r ../src ./train_parallel$i cp -r ../src ./train_parallel$i
cd ./train_parallel$i || exit cd ./train_parallel$i || exit
echo "start training for rank $RANK_ID, device $DEVICE_ID" echo "start training for rank $RANK_ID, device $DEVICE_ID"
......
...@@ -53,7 +53,6 @@ export RANK_SIZE=$DEVICE_NUM ...@@ -53,7 +53,6 @@ export RANK_SIZE=$DEVICE_NUM
rm -rf ./train_parallel rm -rf ./train_parallel
mkdir ./train_parallel mkdir ./train_parallel
cp ../*.py ./train_parallel cp ../*.py ./train_parallel
cp *.sh ./train_parallel
cp -r ../src ./train_parallel cp -r ../src ./train_parallel
cd ./train_parallel || exit cd ./train_parallel || exit
......
...@@ -56,7 +56,6 @@ then ...@@ -56,7 +56,6 @@ then
fi fi
mkdir ./eval mkdir ./eval
cp ../*.py ./eval cp ../*.py ./eval
cp *.sh ./eval
cp -r ../src ./eval cp -r ../src ./eval
cd ./eval || exit cd ./eval || exit
env > env.log env > env.log
......
...@@ -57,7 +57,6 @@ then ...@@ -57,7 +57,6 @@ then
fi fi
mkdir ./eval mkdir ./eval
cp ../*.py ./eval cp ../*.py ./eval
cp *.sh ./eval
cp -r ../src ./eval cp -r ../src ./eval
cd ./eval || exit cd ./eval || exit
env > env.log env > env.log
......
...@@ -60,7 +60,6 @@ then ...@@ -60,7 +60,6 @@ then
fi fi
mkdir ./train mkdir ./train
cp ../*.py ./train cp ../*.py ./train
cp *.sh ./train
cp -r ../src ./train cp -r ../src ./train
cd ./train || exit cd ./train || exit
echo "start training for device $DEVICE_ID" echo "start training for device $DEVICE_ID"
......
...@@ -61,7 +61,6 @@ then ...@@ -61,7 +61,6 @@ then
fi fi
mkdir ./train mkdir ./train
cp ../*.py ./train cp ../*.py ./train
cp *.sh ./train
cp -r ../src ./train cp -r ../src ./train
cd ./train || exit cd ./train || exit
......
...@@ -23,7 +23,7 @@ cfg = edict({ ...@@ -23,7 +23,7 @@ cfg = edict({
'lr': 0.01, 'lr': 0.01,
"momentum": 0.9, "momentum": 0.9,
{% elif optimizer=='SGD' %} {% elif optimizer=='SGD' %}
'lr': 0.1, 'lr': 0.01,
{% else %} {% else %}
'lr': 0.001, 'lr': 0.001,
{% endif %} {% endif %}
......
...@@ -67,7 +67,6 @@ do ...@@ -67,7 +67,6 @@ do
rm -rf ./train_parallel$i rm -rf ./train_parallel$i
mkdir ./train_parallel$i mkdir ./train_parallel$i
cp ../*.py ./train_parallel$i cp ../*.py ./train_parallel$i
cp *.sh ./train_parallel$i
cp -r ../src ./train_parallel$i cp -r ../src ./train_parallel$i
cd ./train_parallel$i || exit cd ./train_parallel$i || exit
echo "start training for rank $RANK_ID, device $DEVICE_ID" echo "start training for rank $RANK_ID, device $DEVICE_ID"
......
...@@ -54,7 +54,6 @@ export RANK_SIZE=$DEVICE_NUM ...@@ -54,7 +54,6 @@ export RANK_SIZE=$DEVICE_NUM
rm -rf ./train_parallel rm -rf ./train_parallel
mkdir ./train_parallel mkdir ./train_parallel
cp ../*.py ./train_parallel cp ../*.py ./train_parallel
cp *.sh ./train_parallel
cp -r ../src ./train_parallel cp -r ../src ./train_parallel
cd ./train_parallel || exit cd ./train_parallel || exit
......
...@@ -56,7 +56,6 @@ then ...@@ -56,7 +56,6 @@ then
fi fi
mkdir ./eval mkdir ./eval
cp ../*.py ./eval cp ../*.py ./eval
cp *.sh ./eval
cp -r ../src ./eval cp -r ../src ./eval
cd ./eval || exit cd ./eval || exit
env > env.log env > env.log
......
...@@ -57,7 +57,6 @@ then ...@@ -57,7 +57,6 @@ then
fi fi
mkdir ./eval mkdir ./eval
cp ../*.py ./eval cp ../*.py ./eval
cp *.sh ./eval
cp -r ../src ./eval cp -r ../src ./eval
cd ./eval || exit cd ./eval || exit
env > env.log env > env.log
......
...@@ -59,7 +59,6 @@ then ...@@ -59,7 +59,6 @@ then
fi fi
mkdir ./train mkdir ./train
cp ../*.py ./train cp ../*.py ./train
cp *.sh ./train
cp -r ../src ./train cp -r ../src ./train
cd ./train || exit cd ./train || exit
echo "start training for device $DEVICE_ID" echo "start training for device $DEVICE_ID"
......
...@@ -59,7 +59,6 @@ then ...@@ -59,7 +59,6 @@ then
fi fi
mkdir ./train mkdir ./train
cp ../*.py ./train cp ../*.py ./train
cp *.sh ./train
cp -r ../src ./train cp -r ../src ./train
cd ./train || exit cd ./train || exit
echo "start training" echo "start training"
......
...@@ -30,7 +30,7 @@ cfg = ed({ ...@@ -30,7 +30,7 @@ cfg = ed({
"momentum": 0.9, "momentum": 0.9,
"lr": 0.01, "lr": 0.01,
{% elif optimizer=='SGD' %} {% elif optimizer=='SGD' %}
'lr': 0.1, 'lr': 0.01,
{% else %} {% else %}
'lr': 0.001, 'lr': 0.001,
{% endif %} {% endif %}
......
...@@ -91,6 +91,7 @@ class CreateProject(BaseCommand): ...@@ -91,6 +91,7 @@ class CreateProject(BaseCommand):
if not choice: if not choice:
click.secho(textwrap.dedent("Network is required."), fg='red') click.secho(textwrap.dedent("Network is required."), fg='red')
click.secho(textwrap.dedent("Your choice is %s." % network_type_choices[choice - 1]), fg='yellow')
return network_type_choices[choice - 1] return network_type_choices[choice - 1]
@staticmethod @staticmethod
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册