google-research / tapas

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

Tapas classifier experiment doesn't disable v2 tensorflow behaviour which leads to AttributeError #187

Open Maxvgrad opened 2 months ago

Maxvgrad commented 2 months ago

When running tapas_classifier_experiment.py leads to the error AttributeError: 'int' object has no attribute 'value'.

The issue happens because the file doesn't disable_v2_behavior

tapas_classifier_experiment ``` python tapas/experiments/tapas_classifier_experiment.py \ --use_tpu=False \ ... --eval_interactions_file="${BASE_DIR}/${FT_RESULTS_DIR}/interactions/random-split-1-dev.tfrecord" \ --predict_interactions_file="${BASE_DIR}/${FT_RESULTS_DIR}/interactions/test.tfrecord" \ --do_train ```
Error stacktrace ``` Traceback (most recent call last): File "tapas/experiments/tapas_classifier_experiment.py", line 589, in app.run(main) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/absl/app.py", line 308, in run _run_main(main, args) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/absl/app.py", line 254, in _run_main sys.exit(main(argv)) File "tapas/experiments/tapas_classifier_experiment.py", line 493, in main estimator.train(input_fn=train_input_fn, max_steps=total_steps) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3083, in train rendezvous.raise_errors() File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/error_handling.py", line 150, in raise_errors six.reraise(typ, value, traceback) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/six.py", line 719, in reraise raise value File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3078, in train saving_listeners=saving_listeners) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 349, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1182, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1211, in _train_model_default self.config) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 2915, in _call_model_fn config) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1170, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 3173, in _model_fn features, labels, is_export_mode=is_export_mode) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 1700, in call_without_tpu return self._call_model_fn(features, labels, is_export_mode=is_export_mode) File "/gpfs/space/home/ploter/.conda/envs/tapas_clean_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 2031, in _call_model_fn estimator_spec = self._model_fn(features=features, **kwargs) File "/gpfs/space/home/ploter/projects/tapas/tapas/models/tapas_classifier_model.py", line 1044, in model_fn classification_class_index=classification_class_index) File "/gpfs/space/home/ploter/projects/tapas/tapas/models/tapas_classifier_model.py", line 701, in _get_classification_outputs hidden_size_agg = output_layer_aggregation.shape[-1].value AttributeError: 'int' object has no attribute 'value' ```