juntaoy / dali-full-anaphora

A Cluster Ranking Model for Full Anaphora Resolution
Apache License 2.0
9 stars 2 forks source link

Cannot calculate BERT embeddings under GPU environment #6

Closed WinterShiver closed 3 years ago

WinterShiver commented 3 years ago

My problem when running your code for your LREC20 paper: cannot calculate BERT embeddings under GPU environment. My environment: Titan XP, cuda 9.0. I have installed all the required packages under my Python environment, and done all the previous procedures successfully (including those in setup.sh and get_char_vocab.py). However when running extract_bert_features.sh, I have got:

(dali) [username@servername extract_bert_features]$ sh extract_bert_features.sh 
Traceback (most recent call last):
  File "extract_features.py", line 357, in <module>
    tf.app.run()
  File "/home/username/anaconda3/envs/dali/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "extract_features.py", line 270, in main
    is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2
AttributeError: 'module' object has no attribute 'InputPipelineConfig'

Could you help me on this problem? Many thanks.

juntaoy commented 3 years ago

I think this error is related to the tf version, so BERT part needs a higher version of tenserflow, I use 1.12 in my case for extract BERT embeddings and the main model uses 1.8 version. This means you will need setup another conda env for BERT

WinterShiver commented 3 years ago

Issue fixed. Thank you!