melodyguan / enas

TensorFlow Code for paper "Efficient Neural Architecture Search via Parameter Sharing"
https://arxiv.org/abs/1802.03268
Apache License 2.0
1.58k stars 390 forks source link

UnboundLocalError #33

Open ghost opened 6 years ago

ghost commented 6 years ago

I am attempting to use an architecture from cifar10_macro_search and am getting this error. Please advise.


Path outputs exists. Remove and remake.

Logging to outputs/stdout

batch_size...................................................................100 child_block_size...............................................................3 child_cutout_size...........................................................None child_drop_path_keep_prob....................................................1.0 child_filter_size..............................................................5 child_fixed_arc5 2 1 0 0 1 0 0 0 1 3 1 0 1 1 4 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 5 0 0 1 0 0 1 0 0 4 0 0 0 1 0 1 0 1 0 4 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 child_grad_bound.............................................................5.0 child_keep_prob..............................................................0.5 child_l2_reg..............................................................0.0002 child_lr.....................................................................0.1 child_lr_T_0..................................................................10 child_lr_T_mul.................................................................2 child_lr_cosine.............................................................True child_lr_dec_every...........................................................100 child_lr_dec_rate............................................................0.1 child_lr_max................................................................0.05 child_lr_min...............................................................0.001 child_num_aggregate.........................................................None child_num_branches.............................................................4 child_num_cells................................................................5 child_num_layers..............................................................12 child_num_replicas.............................................................1 child_out_filters.............................................................48 child_out_filters_scale........................................................1 child_skip_pattern..........................................................None child_sync_replicas........................................................False child_use_aux_heads.........................................................True controller_bl_dec...........................................................0.99 controller_entropy_weight.................................................0.0001 controller_forwards_limit......................................................2 controller_keep_prob.........................................................0.5 controller_l2_reg............................................................0.0 controller_lr..............................................................0.001 controller_lr_dec_rate.......................................................1.0 controller_num_aggregate......................................................20 controller_num_replicas........................................................1 controller_op_tanh_reduce....................................................2.5 controller_search_whole_channels............................................True controller_skip_target.......................................................0.4 controller_skip_weight.......................................................0.8 controller_sync_replicas....................................................True controller_tanh_constant.....................................................1.5 controller_temperature......................................................None controller_train_every.........................................................1 controller_train_steps........................................................50 controller_training........................................................False controller_use_critic......................................................False data_format.................................................................NCHW data_path...........................................................data/cifar10 eval_every_epochs..............................................................1 log_every.....................................................................50 num_epochs...................................................................310 output_dir...............................................................outputs reset_output_dir............................................................True search_for.................................................................macro

Reading data data_batch_1 data_batch_2 data_batch_3 data_batch_4 data_batch_5 test_batch Prepropcess: [subtract mean], [divide std] mean: [125.30723 122.95053 113.86535] std: [62.993362 62.088478 66.70482 ]

Build model child Build data ops

Build train graph Traceback (most recent call last): File "src/cifar10/main.py", line 359, in tf.app.run() File "/home/zachary_swartz/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "src/cifar10/main.py", line 355, in main train() File "src/cifar10/main.py", line 223, in train ops = get_ops(images, labels) File "src/cifar10/main.py", line 190, in get_ops child_model.connect_controller(None) File "/home/zachary_swartz/enas/src/cifar10/general_child.py", line 705, in connect_controller self._build_train() File "/home/zachary_swartz/enas/src/cifar10/general_child.py", line 595, in _build_train logits = self._model(self.x_train, is_training=True) File "/home/zachary_swartz/enas/src/cifar10/general_child.py", line 212, in _model x = self._fixed_layer(layer_id, layers, start_idx, out_filters, is_training) File "/home/zachary_swartz/enas/src/cifar10/general_child.py", line 481, in _fixed_layer return out UnboundLocalError: local variable 'out' referenced before assignment

ghost commented 6 years ago

So I've determined that this error occurs when the "start index" is either 4 or 5 (average and max pooling). If this is the case, then out never gets gets instantiated. I have also noticed that your example architecture in cifar_macro_final contains no average or max pooling. Is there a reason for this? Am I not understanding something about the encoded architecture?

yeshwanthv5 commented 6 years ago

Same issue. Looks like Pooling layers are not supported when a fixed architecture is retrained. Or are we missing something here?