huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
134.73k stars 26.94k forks source link

Error when runnig run_tf_ner.py #3087

Closed mrm8488 closed 4 years ago

mrm8488 commented 4 years ago

🐛 Bug

Information

!python3 /content/transformers/examples/ner/run_tf_ner.py --data_dir /content/ner_dataset \
--model_type bert \
--labels /content/labels.txt \
--model_name_or_path dccuchile/bert-base-spanish-wwm-cased \
--output_dir model_output \
--max_seq_length 256 \
--num_train_epochs 5\
--per_gpu_train_batch_size 42 \
--save_steps 2000\
--do_train \
--do_eval

Traceback (most recent call last):
  File "/content/transformers/examples/ner/run_tf_ner.py", line 14, in <module>
    from transformers import (
ImportError: cannot import name 'GradientAccumulator'

Transformer version transformers==2.5.1

LysandreJik commented 4 years ago

You should not have any issues with this as GradientAccumulator is correctly imported in the init.py file:

https://github.com/huggingface/transformers/blob/298bed16a841fae3608d334441ccae4d9043611f/src/transformers/__init__.py#L426-L427

Is transformers correctly installed in your pip environment, or did you simply clone the repository?

mrm8488 commented 4 years ago

Ok. Thank you. I cannot check it now because Colab PRO accounts are having problems. I will let you know ASAP.

over-shine commented 4 years ago

I met analogous problem,but it was solved after rebooting computer. And another issue is it can not find the installed module,this issue can be solved by reinstall the module that can not be found.

mrm8488 commented 4 years ago

In my case I was not using tf 2.x

El mar., 10 mar. 2020 9:50, over-shine notifications@github.com escribió:

I met analogous problem,but it was solved after rebooting computer. And another issue is it can not find the installed module,this issue can be solved by reinstall the module that can not be found.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/huggingface/transformers/issues/3087?email_source=notifications&email_token=AA34BHNOLTNBPN37WKT4UELRGX5MHA5CNFSM4K73DTO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKQYOY#issuecomment-596970555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA34BHIJAGHRKSZE5TNILB3RGX5MHANCNFSM4K73DTOQ .