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

Import issue while using tensorflow.keras

boubasse opened this issue · comments

Hi,

Very good work for implementing this :)
However, the TF_KERAS environnement doesn't work to select the rightAdamW from the right optimizers file ... I set the variable at the beginning of my code and debug mode shows it is present.
Therefore, I'm doing from keras_adamw.optimizers_v2 import AdamW and it works :)

It seems that using the direct import from keras_adamw import AdamW, it goes in the the optimizers225.py

Thanks for your work

Glad you find it useful, and thanks for reporting. On the import, do you set it like this?

import os
os.environ['TF_KERAS'] = '1'
from keras_adamw import AdamW

If not, it'd help to have some minimal reproducible code. You can also inspect __init__.py to see how automatic optimizer selection works; try inserting print(os.environ['TF_KERAS']) after import os in that file and run the program; does it print '1'?

Closing due to inactivity; feel free to reopen.