Transformers: ImportError: cannot import name 'WEIGHTS_NAME' from 'pytorch_pretrained_bert.file_utils'

Created on 23 Apr 2019  路  6Comments  路  Source: huggingface/transformers

I just tried to run run_squad.py example and I got this error:

Traceback (most recent call last):
  File "run_squad.py", line 37, in <module>
    from pytorch_pretrained_bert.file_utils import PYTORCH_PRETRAINED_BERT_CACHE, WEIGHTS_NAME, CONFIG_NAME
ImportError: cannot import name 'WEIGHTS_NAME' from 'pytorch_pretrained_bert.file_utils' (/mnt/Data/miniconda3/lib/python3.7/site-packages/pytorch_pretrained_bert/file_utils.py)

Most helpful comment

Same is happening for run_classifier.py

All 6 comments

Same is happening for run_classifier.py

Yes the examples currently require to install from source (see the section in the readme).
I'll release a new version tomorrow so the pip release will be in sync with master examples again.

Okay, thank you :)

Waiting for this; installing from source gives the error : ImportError: cannot import name 'warmup_linear'

Waiting for this; installing from source gives the error : ImportError: cannot import name 'warmup_linear'

It is not actually using warmup_linear so you can safely remove that from the file

Ok, I've just published and uploaded the new v0.6.2 release on pip which should fix this (among other things). Release notes are here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hsajjad picture hsajjad  路  3Comments

quocnle picture quocnle  路  3Comments

HanGuo97 picture HanGuo97  路  3Comments

lcswillems picture lcswillems  路  3Comments

yspaik picture yspaik  路  3Comments