google-research / albert

ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
Apache License 2.0
3.24k stars 569 forks source link

TypeError: '<' not supported between instances of 'int' and 'NoneType' while only predicting, try to fix it, but not sure is it make sense #221

Open alznn opened 4 years ago

alznn commented 4 years ago

https://github.com/google-research/albert/blob/0c88e1e0cdab54593ec5c485c5e27a3bb16949ad/run_squad_v1.py#L463

As tittle, the issue happen when setting _--dotrain=False and _--dopredict=true

The way I fix it is adding num_train_steps = int(len(eval_examples) / FLAGS.predict_batch_size * FLAGS.num_train_epochs)

under the code eval_examples = squad_utils.read_squad_examples(input_file=FLAGS.predict_file, is_training=False)

but, I am not sure is it correct way (cause it seems do evaluate in the function, and will save the best checkpoint, which I think it looks more like "evaluate", not predicting)

maimaimaiya commented 3 years ago

train_examples = squad_utils.read_squad_examples( input_file=FLAGS.train_file, is_training=True) num_train_steps = int( len(train_examples) / FLAGS.train_batch_size FLAGS.num_train_epochs) if FLAGS.do_train: num_warmup_steps = int(num_train_steps FLAGS.warmup_proportion)

Referring to run_squad_v2.py, put num_train_steps outside.

AetherPrior commented 3 years ago

Is this issue fixed now? I'd like to check it out