-
Notifications
You must be signed in to change notification settings - Fork 614
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
module 'tensorflow_addons' has no attribute 'optimizers' (tfa-nightly) #2578
Comments
/cc @szutenberg |
Hi @MR-T77 I tried to reproduce it:
Everything seems to be ok. Please check if you can run the following code: import tensorflow_addons as tfa
print(tfa)
print(tfa.optimizers)
print(tfa.optimizers.RectifiedAdam) What does it return? If you're still getting an error then please attach the output from |
Hi @szutenberg!
|
/cc @lgeiger Can you replicate this on your M1? |
@MR-T77 It looks that there are no issues with TFA but there are missing GPU kernels which breaks collocation. You need to check what types do you use with Equal, Mul and FloorDiv. You can dump graphs (TF_DUMP_GRAPH_PREFIX + turn on vlog) and check it in pbtxt file. |
@szutenberg I'm a newbie on this type of things, sorry. Could you please point me to more detailed description of what I need to do? Thanks in advance |
Also, I'm not using any custom code here. It's a simple BLSTM (3-layer keras Bidirectional(simpleRNN) with a dense output) |
@MR-T77 maybe the easiest would be to provide the code so that we can reproduce it locally. İf you want to debug it on your own then set TF_CPP_MAX_VLOG_LEVEL to 10, and TF_DUMP_GRAPH_PREFİX=tmp. You should see tmp dir after running the script. Reading placer_input.pbtxt will answer to my question (simply grep -A 20 -rn FloorDiv). You'll see dtypes. Anyway I'm traveling now so I'm not able to help you further until ~12th October. |
@szutenberg thank you so much for your availability to help! I'll try to understand what's wrong until 12th October. If I'm unsuccessful, I'll contact again. |
@szutenberg anyways, I leave here the code I'm using, just in case it's a easy thing you can spot on:
|
Have you already tried with https://www.tensorflow.org/api_docs/python/tf/config/set_soft_device_placement ? |
@szutenberg Could it be a side effect of your introduced |
Yes, it's there in the code: "tf.config.set_soft_device_placement(True)" |
@MR-T77 Yes sorry I missed, is that your code is not well formatted. |
Hi @MR-T77 I'm back. Have you solved the issue? Today I tried to reproduce your problem and unfortunately, the code requires pickle which is not attached. I created dummy training data and everything works fine - FloorDiv (T=INT64) is placed on GPU. Graphs don't contain name "conv_1_3x3_conv" so probably the code I got did not produce the error message you attached. Please provide full code and all required files together with frozen pip list (pip freeze). |
Hi @szutenberg! |
And to be complete, in my original code (the one with conv layers) I am getting the same error as initially exposed ("Cannot assign a divide for operation..."). Nevertheless, if I replace the optimizer by the simple keras.optimizers.Adam, I can train the model. |
Hi @MR-T77 , I'm sorry but it seems that one more file is missing: definitions.py Could you make sure that it reproduces on google colab? |
Hi @szutenberg, |
Hi @MR-T77 , Unfortunately now I have another error: Could you please prepare google colab which demonstrates your problem? Note that you don't need to provide real data - dummy training data is enough: you just need to make sure that shapes match. Thanks! |
Yes a Colab with dummy input data is the best thing to share so we could verify if it is something only related to your MacOs M1 platform or a more general issue. |
Hi @szutenberg and @bhack : sorry for my late reply but I was trying to generate dummy data, but I couldn't do it without further errors (I'm a newbie). |
Hi @MR-T77 I took the code from colab and was able to run it in my virtual env (Ubuntu 20.04): All ops Equal are placed on GPU and everything works fine. |
Hi @szutenberg, So, do you think it is some clash between libraries in my environment or other reason? |
@lgeiger Can you try to see if you can reproduce this on your M1 ? |
I just want to clarify that I can run this exact code with no problems if I use tf.keras.Adam. If I start using tf-addons optimizers (e.g. Radam) I get the above errors. |
Can you check your device placement: https://www.tensorflow.org/api_docs/python/tf/debugging/set_log_device_placement |
Hi @bhack , I did as you said and got this:
After this I get the error message:
|
Do you have |
@lgeiger: you are right. When I uninstalled tensorflow-metal, I stopped getting the error. But of course, everything starts running only in CPU. |
For now, unfortunately yes. It seems like some operation is not yet supported by the metal device, but I am not sure if the TFA optimizer could be rewritten to either not use this op or to not require it to be placed on the same device as the other devices in the group. |
Thank you for your answer. Nevertheless, given the inability of Apple to provide support for developers, I hope you find some ingenious solution on your side. |
The official Apple support is at https://developer.apple.com/forums/tags/tensorflow-metal |
@bhack I know, I've been trying but they just don't give support. |
What is your thread there? |
If is this one https://developer.apple.com/forums/thread/692818 I suppose that just 4 days old with Saturday and Sunday it isn't too much long as waiting time. |
That's not mine. But you can check this one (very similar to my problem), which was posted 3 months ago. I've got other 2 threads (my user is the same, so you can search by that) posted almost 1 month ago, also not solved by Apple. Besides this, I also submitted the issue through Feedback Assistant, but I have not any feedback. |
|
@bhack I understand that and I sincerely thank you for your help (which I requested because I thought it was something related to tensorflow-addons). If I could change my computer, I'd also achieve a solution, but I can't. |
Have you tried with tensorflow-macos 2.6? Edit: |
Yes, I've been trying with 2.6. |
Ok I'am going to close this.. Please add a comment later if you have any news.. |
Ok, I'm back to this after a while.
The base code is always the same, I use Here are a pair of example error outputs (obtained with the pylast conda environment):
and
|
@MR-T77 Just to be sure that it is reproducible on an environment under control with linux can you test the same with Docker + TFA pip: https://www.tensorflow.org/install/docker So that we could exclude that is related only to |
I'm afraid I can't really help. Installed Docker and tried to pull and run latest tensorflow and got this error |
Yes probably they still not have added avx emulation support in QEMU for m1 or it is a Docker specific issue on m1 like docker/for-mac#6111. If you can isolate the case and reproduce your error with a minimal code (e.g. like a test) we could try to run it on linux. As tensorflow-macos and tensorflow-metal are closed source packages we cannot do anything here in the case we cannot reproduce the issue on another platform. |
Well, I was just trying to provide further details, to see if it would help. |
Ok try to post also on https://developer.apple.com/forums/tags/tensorflow-metal |
I submitted it to https://developer.apple.com/forums/thread/706952 |
Just to keep this info updated: I have a github repo with a stripped down version of my code (with the needed audio data) that does reproduce the issue (in a Mac M1). I also shared this with Apple, but unfortunately, they're not very responsive. |
Hi again, I'm back at this as the problem remains (and it's even more frequent after I updated the conda environment), and Apple Developer Forums are not responding. I'm using this code:
but after starting I can see that in tbdump folder there are being created the following type of files, but no pbtxt file:
Any idea on how to make this work? |
TensorFlow Addons is transitioning to a minimal maintenance and release mode. New features will not be added to this repository. For more information, please see our public messaging on this decision: Please consider sending feature requests / contributions to other repositories in the TF community with a similar charters to TFA: |
System information
Describe the bug
After installing from nightly version, I got an error module
'tensorflow_addons' has no attribute 'optimizers'
Code to reproduce the issue
import tensorflow_addons as tfa
...
radam = tfa.optimizers.RectifiedAdam(lr=cf["lr"], clipnorm=clipnorm)
Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
The text was updated successfully, but these errors were encountered: