OverLordGoldDragon / keras-adamw

Keras/TF implementation of AdamW, SGDW, NadamW, Warm Restarts, and Learning Rate multipliers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keras.legacy no longer present

lakshmanok opened this issue · comments

Looks like keras.legacy is no longer part of 2.4:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-c6757b174f2e> in <module>()
----> 1 from keras_adamw import AdamW
      2 import tensorflow_hub as hub
      3 import os
      4 
      5 # Load compressed models from tensorflow_hub

1 frames
/usr/local/lib/python3.6/dist-packages/keras_adamw/optimizers.py in <module>()
      1 import numpy as np
      2 from keras import backend as K
----> 3 from keras.legacy import interfaces
      4 from keras.optimizers import Optimizer
      5 from .utils import _init_weight_decays, _apply_weight_decays, _check_args

ModuleNotFoundError: No module named 'keras.legacy'

@lakshmanok Thanks for the report. I've dropped support for future versions of keras, but tensorflow.keras should still work; use os.environ['TF_KERAS'] = '1' before from keras_adamw import ....

Thanks! Yes, I had the os.environ() after the import ... with it before the import, works like a charm.
Thanks for the package.