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

ImportError: cannot import name 'FP16_Optimizer' #593

Open
jiangnanyida opened this issue Nov 7, 2019 · 3 comments
Open

ImportError: cannot import name 'FP16_Optimizer' #593

jiangnanyida opened this issue Nov 7, 2019 · 3 comments

Comments

@jiangnanyida
Copy link

I have the some problem when import apex on colab.
the wdir is apex, I execute the code to install apex
!git clone https://github.com/NVIDIA/apex.git
%cd apex
!pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext"

But it seems that it fails to find the path of fp16_optimizer and FusedAdam at optimizer folder
ImportError: cannot import name 'FP16_Optimizer'
ImportError: Please install apex from https://www.github.com/nvidia/apex

@ptrblck
Copy link
Contributor

ptrblck commented Nov 10, 2019

Are you directly importing FP16_Optimizer in your code?
If so, the current apex version might produce this issue, as FP16_Optimizer was moved to contrib/optimizers.

That being said, FP16_Optimizer is deprecated, so please don't import and use it manually.

Let us know, if that fixes the problem.

@jiangnanyida
Copy link
Author

Yes it fixes the problem, thx!
I was executing code from some outdated example, in which FP16_Optimizer was used.
Thanks for your assistance!

@conquerSelf
Copy link

Are you directly importing FP16_Optimizer in your code?
If so, the current apex version might produce this issue, as FP16_Optimizer was moved to contrib/optimizers.

That being said, FP16_Optimizer is deprecated, so please don't import and use it manually.

Let us know, if that fixes the problem.

Thanks for your suggestion so much!
I solve this problem by changing the original code:
Original code: from apex.optimizers import FusedAdam
Correct code: from apex.contrib.optimizers import FusedAdam

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

No branches or pull requests

3 participants