Anton Kroegeler
Anton Kroegeler

Reputation: 11

cannot import name 'global_policy' from 'keras.mixed_precision' since today

I was importing a Swin-Transformer like this, which used to work the last week:

pip install tfswin from tfswin import SwinTransformerLarge224

Since today I get the following error:

"----> 3 from keras.mixed_precision import global_policy

ImportError: cannot import name 'global_policy' from 'keras.mixed_precision' (/usr/local/lib/python3.7/dist-packages/keras/mixed_precision/init.py)"

I tried pip installing those packages as well as setting global policy with set_global_policy('float 32'). Nothing seems to work. Is it likely this is going to work again tomorrow ? Im a bit time pressured because it's a master thesis and this was the first Swin import that worked for me. TF version is 2.10.0

Upvotes: 0

Views: 158

Answers (1)

Anton Kroegeler
Anton Kroegeler

Reputation: 11

Fixed it with !pip install keras==2.9.0.

Upvotes: 1

Related Questions