google-research / tapas

End-to-end neural table-text understanding models.
Apache License 2.0
1.15k stars 217 forks source link

Questions about fine-tuning on the TABFACT task #96

Closed wcc17864158993 closed 3 years ago

wcc17864158993 commented 3 years ago

Hi, I have found a question when I was running the codes with "predict_and_evluate" mode.

If I used the following commands:

! python3 tapas-master/tapas/run_task_main.py \
  --task="TABFACT" \
  --output_dir="results_data" \
  --model_dir="med_reset" \
  --init_checkpoint="tapas_medium_model/model.ckpt" \
  --bert_config_file="tapas_medium_model/bert_config.json" \
  --mode="predict_and_evaluate"

the error would be

Traceback (most recent call last):
  File "tapas-master/tapas/run_task_main.py", line 819, in <module>
    app.run(main)
  File "/opt/conda/lib/python3.6/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/opt/conda/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "tapas-master/tapas/run_task_main.py", line 804, in main
    loop_predict=FLAGS.loop_predict,
  File "tapas-master/tapas/run_task_main.py", line 502, in _train_and_predict
    global_step=current_step,
  File "tapas-master/tapas/run_task_main.py", line 553, in _predict
    global_step=None,
  File "tapas-master/tapas/run_task_main.py", line 614, in _predict_for_set
    output_token_probabilities=False)
TypeError: write_predictions() got an unexpected keyword argument 'output_token_probabilities'

However if I used commands from the TAPAS package, it will run correctly.

! python3 -m tapas.run_task_main \
  --task="TABFACT" \
  --output_dir="results_data" \
  --model_dir="med_reset" \
  --init_checkpoint="tapas_medium_model/model.ckpt" \
  --bert_config_file="tapas_medium_model/bert_config.json" \
  --mode="predict_and_evaluate"

Could you please help me with this issue?

ghost commented 3 years ago

Thanks for reporting. Maybe that's a problem with the current release. We'll have a look!

eisenjulian commented 3 years ago

I think this is a problem with having two different versions of the code in python at the same time. The output_token_probabilities argument was added in a recent version that hasn't been released in the PyPI package yet, but when you launch the code with python3 tapas-master/tapas/run_task_main.py it's most likely using the pip package and not the files in your checked out repository. I recommend choosing one of the two. If you want to run locally you will have to uninstall the version you have from PyPI (pip uninstall tapas-table-parsing) and then install the version you have checked out (pip install -e ./tapas-master)

Let us know if this solves your issue

wcc17864158993 commented 3 years ago

Thanks for your replay! I has solved this problems.