Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix import on current apex #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix import on current apex #42

wants to merge 1 commit into from

Conversation

esemeniuc
Copy link

@esemeniuc esemeniuc commented Dec 5, 2019

Fixes the error:

Traceback (most recent call last):
  File "unilm/src/biunilm/run_seq2seq.py", line 21, in <module>
    from pytorch_pretrained_bert.tokenization import BertTokenizer, WhitespaceTokenizer
  File "/content/unilm/src/pytorch_pretrained_bert/__init__.py", line 6, in <module>
    from .optimization_fp16 import FP16_Optimizer_State
  File "/content/unilm/src/pytorch_pretrained_bert/optimization_fp16.py", line 4, in <module>
    from apex.optimizers import FP16_Optimizer
ImportError: cannot import name 'FP16_Optimizer'

@donglixp
Copy link
Contributor

donglixp commented Dec 5, 2019

Thanks for the P&R. We use the following version of apex, whose APIs are quite different to the current version.

git clone -q https://github.com/NVIDIA/apex.git
cd apex
git reset --hard 1603407bf49c7fc3da74fceb6a6c7b47fece2ef8
python setup.py install --user --cuda_ext --cpp_ext

We will keep the commit here for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants