update codes

This commit is contained in:
D-X-Y
2019-02-01 04:03:35 +11:00
parent 3f9b54d99e
commit 65d9c1c57f
11 changed files with 103 additions and 55 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env sh
if [ "$#" -ne 2 ] ;then
echo "Input illegal number of parameters " $#
echo "Need 2 parameters for the GPUs and the network"
exit 1
fi
if [ "$TORCH_HOME" = "" ]; then
echo "Must set TORCH_HOME envoriment variable for data dir saving"
exit 1
else
echo "TORCH_HOME : $TORCH_HOME"
fi
gpus=$1
arch=$2
cutout=0
dataset=cifar10
epoch=200
SAVED=./snapshots/NAS/ACC-V2-Search-${arch}-${dataset}-cut${cutout}-${epoch}-E600
CUDA_VISIBLE_DEVICES=${gpus} python ./exps-cnn/DARTS-Search.py \
--data_path $TORCH_HOME/cifar.python \
--arch ${arch} --dataset ${dataset} --batch_size 128 \
--save_path ${SAVED} \
--learning_rate_max 0.025 --learning_rate_min 0.001 --momentum 0.9 --weight_decay 0.0003 \
--epochs ${epoch} --cutout ${cutout} --validate --grad_clip 5 \
--init_channels 16 --layers 8 \
--model_config ./configs/nas-cifar-cos.config \
--print_freq 100 --workers 10

45
scripts-cnn/search.sh Normal file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env sh
if [ "$#" -ne 3 ] ;then
echo "Input illegal number of parameters " $#
echo "Need 3 parameters for the GPUs and the network and the dataset"
exit 1
fi
if [ "$TORCH_HOME" = "" ]; then
echo "Must set TORCH_HOME envoriment variable for data dir saving"
exit 1
else
echo "TORCH_HOME : $TORCH_HOME"
fi
gpus=$1
arch=$2
cutout=0
dataset=$3
epoch=50
SAVED=./snapshots/NAS/Search-${arch}-${dataset}-cut${cutout}-${epoch}
if [ "$dataset" == "cifar10" ] ;then
dataset_root=$TORCH_HOME/cifar.python
print_freq=100
elif [ "$dataset" == "cifar100" ] ;then
dataset_root=$TORCH_HOME/cifar.python
print_freq=100
elif [ "$dataset" == "tiered" ] ;then
dataset_root=$TORCH_HOME/tiered-imagenet
print_freq=500
else
echo 'invalid dataset-name :'${dataset}
exit 1
fi
CUDA_VISIBLE_DEVICES=${gpus} python ./exps-cnn/DARTS-Search.py \
--data_path ${dataset_root} \
--arch ${arch} \
--dataset ${dataset} --batch_size 64 \
--save_path ${SAVED} \
--learning_rate_max 0.025 --learning_rate_min 0.001 --momentum 0.9 --weight_decay 0.0003 \
--epochs ${epoch} --cutout ${cutout} --validate --grad_clip 5 \
--init_channels 16 --layers 8 \
--manualSeed 3858 \
--model_config ./configs/nas-cifar-cos-cut.config \
--print_freq ${print_freq} --workers 8

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env sh
# bash scripts-cnn/train-cifar.sh 0 GDAS cifar10
if [ "$#" -ne 3 ] ;then
# bash scripts-cnn/train-cifar.sh 0 GDAS cifar10 cut
if [ "$#" -ne 4 ] ;then
echo "Input illegal number of parameters " $#
echo "Need 3 parameters for the GPUs, the architecture, and the dataset-name"
echo "Need 4 parameters for the GPUs, the architecture, and the dataset-name, and the cutout"
exit 1
fi
if [ "$TORCH_HOME" = "" ]; then
@@ -15,13 +15,14 @@ fi
gpus=$1
arch=$2
dataset=$3
SAVED=./snapshots/NAS/${arch}-${dataset}-E600
cutout=$4
SAVED=./snapshots/NAS/${arch}-${dataset}-${cutout}-E600
CUDA_VISIBLE_DEVICES=${gpus} python ./exps-nas/train_base.py \
CUDA_VISIBLE_DEVICES=${gpus} python ./exps-cnn/train_base.py \
--data_path $TORCH_HOME/cifar.python \
--dataset ${dataset} --arch ${arch} \
--save_path ${SAVED} \
--grad_clip 5 \
--init_channels 36 --layers 20 \
--model_config ./configs/nas-cifar-cos.config \
--model_config ./configs/nas-cifar-cos-${cutout}.config \
--print_freq 100 --workers 8