Transformers: import Error from official example caused by fastprogress

Created on 4 Jan 2020  路  6Comments  路  Source: huggingface/transformers

馃悰 Bug

Model I am using (Bert, XLNet....): BERT

Language I am using the model on (English, Chinese....): ALL

The problem arise when using:

  • [x] the official example scripts: (give details)
  • [ ] my own modified scripts: (give details)

The tasks I am working on is:

  • [x] an official GLUE/SQUaD task: (give the name)
  • [ ] my own task or dataset: (give details)

To Reproduce

Steps to reproduce the behavior:

V0.2.1 of fastprogress released a couple of days ago seems to cause errors in run_tf_ner.py in the official example.

Traceback (most recent call last):
File "run_tf_ner.py", line 12, in
from fastprogress import master_bar, progress_bar
ImportError: cannot import name 'master_bar' from 'fastprogress' (/usr/local/lib/python3.7/dist-packages/fastprogress/__init__.py)

users need to either downgrade: pip3 install fastprogress==0.1.22
or change the code:
from fastprogress.fastprogress import master_bar, progress_bar

Expected behavior

Environment

  • OS:
  • Python version:
  • PyTorch version:
  • PyTorch Transformers version (or branch):
  • Using GPU ?
  • Distributed of parallel setup ?
  • Any other relevant information:

Additional context

Most helpful comment

I change the:
from fastprogress import master_bar, progress_bar
to
from fastprogress.fastprogress import master_bar, progress_bar
in the ~/fastai/imports/core.py file and it worked

All 6 comments

Thanks for reporting. (and hello @sgugger :)

I'll merge this to fix the immediate issue, but maybe @jplu can chime in: maybe we don't need the fastprogress dependency here?

Closed by #2400

Oh, I forgot to update the __init__ with the new version. Will add back the functions there to make compatibility easier. Thanks for the super quick fix!

Hello!! Thanks @julien-c for pinging me :)

Indeed my code was not compatible with the last version of fastprogress, but I thought to have specified the version in the requirements.txt file but apparently the way of installing the transformers framework has changed recently.

@sgugger good job, I like your fix :)

@julien-c fastprogress if (in my opinion) the most convenient progress bar to use for model training, but I can change if it becomes a problem, as you wish.

Alright let's use fastprogress then! We can clean up the conditional import down the line.

I change the:
from fastprogress import master_bar, progress_bar
to
from fastprogress.fastprogress import master_bar, progress_bar
in the ~/fastai/imports/core.py file and it worked

Was this page helpful?
0 / 5 - 0 ratings