automl icon indicating copy to clipboard operation
automl copied to clipboard

Train error

Open ckqsars opened this issue 6 years ago • 3 comments

When I use export MODEL=efficientdet-d0 export CKPT_PATH=efficientdet-d0 python main.py --training_file_pattern=tfrecord/train*
--model_name=$MODEL
--model_dir=/tmp/$MODEL
--hparams="use_bfloat16=false" --use_tpu=False to train the model on gpu

The error is ValueError: ['batch_size', 'context'] are reserved keys but existed in params {'name': 'efficientdet-d0', 'image_size': 512, 'input_rand_hflip': True, 'train_scale_min': 0.1, 'train_scale_max': 2.0, 'autoaugment_policy': None, 'batch_size': None, 'num_classes': 90, 'skip_crowd_during_training': True, 'min_level': 3, 'max_level': 7, 'num_scales': 3, 'aspect_ratios': [(1.0, 1.0), (1.4, 0.7), (0.7, 1.4)], 'anchor_scale': 4.0, 'is_training_bn': True, 'momentum': 0.9, 'learning_rate': 0.08, 'lr_warmup_init': 0.008, 'lr_warmup_epoch': 1.0, 'first_lr_drop_epoch': 200.0, 'second_lr_drop_epoch': 250.0, 'clip_gradients_norm': 10.0, 'num_epochs': 15, 'alpha': 0.25, 'gamma': 1.5, 'delta': 0.1, 'box_loss_weight': 50.0, 'weight_decay': 4e-05, 'use_bfloat16': False, 'box_class_repeats': 3, 'fpn_cell_repeats': 3, 'fpn_num_filters': 64, 'separable_conv': True, 'apply_bn_for_resampling': True, 'conv_after_downsample': False, 'conv_bn_relu_pattern': False, 'use_native_resize_op': False, 'pooling_type': None, 'fpn_name': None, 'fpn_config': None, 'survival_prob': None, 'lr_decay_method': 'cosine', 'moving_average_decay': 0.9998, 'ckpt_var_scope': None, 'backbone_name': 'efficientnet-b0', 'backbone_config': None, 'resnet_depth': 50, 'model_name': 'efficientdet-d0', 'iterations_per_loop': 100, 'model_dir': '/tmp/efficientdet-d0', 'num_shards': 8, 'num_examples_per_epoch': 120000, 'use_tpu': False, 'backbone_ckpt': '', 'val_json_file': None, 'mode': 'train'}.

ckqsars avatar Mar 26 '20 09:03 ckqsars

I find the batch_size default is 64 but in the logging the batch_size is None.

ckqsars avatar Mar 26 '20 09:03 ckqsars

I commented out the 136th line in hparams_config.py and this solved the problem for me. The line is: h.batch_size = None # unused so far. Even the comment says that it is unused so far and this parameter have a conflict with the _RESERVED_PARAMS_KEYS in tpu_estimator, which are: 'batch_size' and 'context'.

debabicz avatar Mar 26 '20 12:03 debabicz

Fixed the issue. thanks for pointing out the issue.

mingxingtan avatar Mar 26 '20 16:03 mingxingtan