-
Notifications
You must be signed in to change notification settings - Fork 95
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
ValueError: Unknown layer: 'TFOpLambda'. Please ensure you are using a keras.utils.custom_object_scope
#163
Comments
There should be a warning after import tensorflow as tf
from keras_cv_attention_models import *
# [WARNING] Setting TF_USE_LEGACY_KERAS=1. Make sure this is ahead of importing tensorflow or keras. Setting from keras_cv_attention_models import *
import tensorflow as tf
model = tf.keras.models.load_model('eva_giant_patch14_224_imagenet21k-ft1k.h5') Besides, should better creating model and loading weights, instead of loading h5 directly: from keras_cv_attention_models import eva
model = eva.EvaGiantPatch14() |
thank you, it worked. |
the model is loading now, but facing this error while retraining
logits data type and input data type have the same dtype, float32, but still getting this error
|
Can you show a detail usage of that concat? If not sure which data causing that error, just call a import tensorflow as tf
xx = [tf.random.uniform([4, 100]) for _ in range(4)]
xx.append(tf.random.uniform([4, 100], dtype='float16'))
print(tf.concat([tf.cast(ii, 'float32') for ii in xx], axis=-1).shape) |
I am not using the concat operation anywhere in the program, I did try casting the data like this but gives the same error every time
|
Here is the data loading code
|
error
|
|
> ValueError: Unknown layer: 'TFOpLambda'. Please ensure you are using a
keras.utils.custom_object_scope
and that this object is included in the scope.The text was updated successfully, but these errors were encountered: