diff --git a/PaddleSlim/configs/mobilenetv1_resnet50_distillation.yaml b/PaddleSlim/configs/mobilenetv1_resnet50_distillation.yaml index c825edf595e2e1070315be5f73bc094db5579b30..43a8db34a80b7dfcae3ba5e9343ad99a3739bf15 100644 --- a/PaddleSlim/configs/mobilenetv1_resnet50_distillation.yaml +++ b/PaddleSlim/configs/mobilenetv1_resnet50_distillation.yaml @@ -7,7 +7,7 @@ distillers: distillation_loss_weight: 1 l2_distiller: class: 'L2Distiller' - teacher_feature_map: 'fc_1.tmp_0' + teacher_feature_map: 'res_fc.tmp_0' student_feature_map: 'fc_0.tmp_0' distillation_loss_weight: 1 strategies: diff --git a/PaddleSlim/configs/quantization_dist.yaml b/PaddleSlim/configs/quantization_dist.yaml index c178bb26d196b077a2289ab5319d05db7f411090..6f7e6afd512a5eb50b0a32d0998112c6301492aa 100644 --- a/PaddleSlim/configs/quantization_dist.yaml +++ b/PaddleSlim/configs/quantization_dist.yaml @@ -9,7 +9,7 @@ distillers: distillation_loss_weight: 1 l2_distiller: class: 'L2Distiller' - teacher_feature_map: 'fc_1.tmp_0' + teacher_feature_map: 'res_fc.tmp_0' student_feature_map: 'fc_0.tmp_0' distillation_loss_weight: 1 strategies: diff --git a/PaddleSlim/run.sh b/PaddleSlim/run.sh index 0d370e98de4a538f21d1c5d8be43d43cb000252f..14b2b14af8613a854b806ad787002cc7aae23d65 100644 --- a/PaddleSlim/run.sh +++ b/PaddleSlim/run.sh @@ -34,18 +34,22 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3 # Fixing name conflicts in distillation -mv ResNet50_pretrained/conv1_weights ResNet50_pretrained/res_conv1_weights -mv ResNet50_pretrained/fc_0.w_0 ResNet50_pretrained/res_fc.w_0 -mv ResNet50_pretrained/fc_0.b_0 ResNet50_pretrained/res_fc.b_0 +cd ${pretrain_dir}/ResNet50_pretrained +mv conv1_weights res_conv1_weights +mv fc_0.w_0 res_fc.w_0 +mv fc_0.b_0 res_fc.b_0 +cd - python compress.py \ --model "MobileNet" \ --teacher_model "ResNet50" \ --teacher_pretrained_model ./pretrain/ResNet50_pretrained \ --compress_config ./configs/mobilenetv1_resnet50_distillation.yaml -mv ResNet50_pretrained/res_conv1_weights ResNet50_pretrained/conv1_weights -mv ResNet50_pretrained/res_fc.w_0 ResNet50_pretrained/fc_0.w_0 -mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0 +cd ${pretrain_dir}/ResNet50_pretrained +mv res_conv1_weights conv1_weights +mv res_fc.w_0 fc_0.w_0 +mv res_fc.b_0 fc_0.b_0 +cd - # for sensitivity filter pruning #------------------------------- @@ -74,28 +78,32 @@ mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0 # for distillation with quantization #----------------------------------- -#export CUDA_VISIBLE_DEVICES=0 +#export CUDA_VISIBLE_DEVICES=4,5,6,7 # ## Fixing name conflicts in distillation -#mv ResNet50_pretrained/conv1_weights ResNet50_pretrained/res_conv1_weights -#mv ResNet50_pretrained/fc_0.w_0 ResNet50_pretrained/res_fc.w_0 -#mv ResNet50_pretrained/fc_0.b_0 ResNet50_pretrained/res_fc.b_0 +#cd ${pretrain_dir}/ResNet50_pretrained +#mv conv1_weights res_conv1_weights +#mv fc_0.w_0 res_fc.w_0 +#mv fc_0.b_0 res_fc.b_0 +#cd - # #python compress.py \ #--model "MobileNet" \ #--teacher_model "ResNet50" \ -#--teacher_pretrained_model ./data/pretrain/ResNet50_pretrained \ +#--teacher_pretrained_model ./pretrain/ResNet50_pretrained \ #--compress_config ./configs/quantization_dist.yaml # -#mv ResNet50_pretrained/res_conv1_weights ResNet50_pretrained/conv1_weights -#mv ResNet50_pretrained/res_fc.w_0 ResNet50_pretrained/fc_0.w_0 -#mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0 +#cd ${pretrain_dir}/ResNet50_pretrained +#mv res_conv1_weights conv1_weights +#mv res_fc.w_0 fc_0.w_0 +#mv res_fc.b_0 fc_0.b_0 +#cd - # for uniform filter pruning with quantization #--------------------------------------------- #export CUDA_VISIBLE_DEVICES=0 #python compress.py \ #--model "MobileNet" \ -#--pretrained_model ./data/pretrain/MobileNetV1_pretrained \ +#--pretrained_model ./pretrain/MobileNetV1_pretrained \ #--compress_config ./configs/quantization_pruning.yaml