-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Keras_NLP Getting Started Tutorial: Mixed Precision Error; AttributeError: 'LossScaleOptimizerV3' #1747
Comments
Hi, Thanks for reporting the issue. Since we have migrated Keras to support multi backend framework which is Keras 3. Make sure you have keras 3 and install all the dependency packages in the below mentioned order to run the example .
|
Ok, that seemed to work. But I did run into this error during the upgrade of keras to 3.0.4 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. I don't really know why this error popped up. It doesn't seem to make sense for keras 3 to be incompatible with the newest stable version of tensorflow that I am using, 2.15.0. Especially since the notebook works on my machine now. |
if you're installing using requirement.txt file, usually you will end up with this error, since Tensorflow 2.15 installs Keras 2.15 and there will be conflict to this when you install Keras 3. |
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further. |
Issue Type
Bug
Source
source
Keras Version
Keras 2.15
Custom Code
No
OS Platform and Distribution
5.15.133.1-microsoft-standard-WSL2 on (I think)Ubuntu 18.04.6 LTS
Python version
3.9.18
GPU model and memory
NVIDIA GeForce RTX 3080 Ti Laptop GPU 16GB GDDR6 VRAM
Current Behavior?
I am running the code directly from the Keras_NLP getting started guide.
When I try to instantiate the
classifier = keras_nlp.models.BertClassifier.from_preset("bert_tiny_en_uncased_sst2")
, I run into an error. AttributeError: 'LossScaleOptimizerV3' object has no attribute 'name'There is a line in this tutorial that sets a mixed precision policy of mixed_float16. If I comment this out, everything works fine. Why is this error coming up in the documentation?
The only meaningful difference I made to the code is changing
os.environ["Keras_Backend"] = 'jax'
toos.environ["Keras_Backend"] = 'tensorflow'
. I tried it both ways and got the same error and the documentations aid it shouldn't make a difference anyway.Standalone code to reproduce the issue or tutorial link
Relevant log output
The text was updated successfully, but these errors were encountered: