Skip to content
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

Colab demo notebook raises exception #9

Open
crclark opened this issue Feb 27, 2023 · 8 comments
Open

Colab demo notebook raises exception #9

crclark opened this issue Feb 27, 2023 · 8 comments

Comments

@crclark
Copy link

crclark commented Feb 27, 2023

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-2-969c26cf53fe>](https://localhost:8080/#) in <module>
     39     return loaded_model
     40 
---> 41 safety_model = load_safety_model()
     42 
     43 

2 frames
[<ipython-input-2-969c26cf53fe>](https://localhost:8080/#) in load_safety_model(clip_model)
     35             zip_ref.extractall(cache_folder)
     36 
---> 37     loaded_model = load_model(model_dir, custom_objects=ak.CUSTOM_OBJECTS)
     38 
     39     return loaded_model

[/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py](https://localhost:8080/#) in error_handler(*args, **kwargs)
     68             # To get the full stack trace, call:
     69             # `tf.debugging.disable_traceback_filtering()`
---> 70             raise e.with_traceback(filtered_tb) from None
     71         finally:
     72             del filtered_tb

[/usr/local/lib/python3.8/dist-packages/keras/saving/legacy/serialization.py](https://localhost:8080/#) in class_and_config_for_serialized_keras_object(config, module_objects, custom_objects, printable_module_name)
    383     )
    384     if cls is None:
--> 385         raise ValueError(
    386             f"Unknown {printable_module_name}: '{class_name}'. "
    387             "Please ensure you are using a `keras.utils.custom_object_scope` "

ValueError: Unknown optimizer: 'Custom>AdamWeightDecay'. Please ensure you are using a `keras.utils.custom_object_scope` and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.
@PeterAdam2015
Copy link

Same Problems, seem keras can't recognize the customized layer defined in python scripts.

@meigaoms
Copy link

Same here. Could this be related to Keras version?

@SingL3
Copy link

SingL3 commented Apr 11, 2023

Same here, any solutions?

@MSusik
Copy link

MSusik commented Apr 11, 2023

Solution: Downgrade autokeras to 1.0.20

@SingL3
Copy link

SingL3 commented Apr 12, 2023

@MSusik Tried it already in colab demo.

ValueError                                Traceback (most recent call last)
[<ipython-input-3-969c26cf53fe>](https://localhost:8080/#) in <cell line: 41>()
     39     return loaded_model
     40 
---> 41 safety_model = load_safety_model()
     42 
     43 

3 frames
[/usr/local/lib/python3.9/dist-packages/autokeras/keras_layers.py](https://localhost:8080/#) in __init__(self, learning_rate, beta_1, beta_2, epsilon, amsgrad, weight_decay_rate, include_in_weight_decay, exclude_from_weight_decay, name, **kwargs)
    317         **kwargs
    318     ):
--> 319         super(AdamWeightDecay, self).__init__(
    320             learning_rate, beta_1, beta_2, epsilon, amsgrad, name, **kwargs
    321         )

ValueError: decay is deprecated in the new Keras optimizer, pleasecheck the docstring for valid arguments, or use the legacy optimizer, e.g., tf.keras.optimizers.legacy.AdamWeightDecay.

@MSusik
Copy link

MSusik commented Apr 12, 2023

Then you might want play with versions of other packages. For me it works well with tf 2.9

@SingL3
Copy link

SingL3 commented Apr 25, 2023

!pip install clip-anytorch autokeras==1.0.20 tensorflow==2.9

works.

@HCA97
Copy link

HCA97 commented May 28, 2023

Hi, had a similar problem as well, and installing autokeras==1.0.20 tensorflow==2.9 didn't solve my problem. So I converted the models to PyTorch following issue #7 now I can run all the NSFW detectors using PyTorch only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants