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

ValueError: Unknown activation function:softmax_over_time #58

Open
rafaleo opened this issue Mar 7, 2020 · 1 comment
Open

ValueError: Unknown activation function:softmax_over_time #58

rafaleo opened this issue Mar 7, 2020 · 1 comment

Comments

@rafaleo
Copy link

rafaleo commented Mar 7, 2020

I try to run attention.py and it seems it's not possible to fit into memory for me. So I try do some tricks. One is to clean up and read arrays from disk only needed to use model.fit, but in the line
model = load_model("large_files/model.h5")
I get following error:

Traceback (most recent call last):
  File "AT_translate.py", line 32, in <module>
    model = load_model("large_files/"+MODE+"-model.h5")
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper
    return load_function(*args, **kwargs)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\saving.py", line 584, in load_model
    model = _deserialize_model(h5dict, custom_objects, compile)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\saving.py", line 274, in _deserialize_model
    model = model_from_config(model_config, custom_objects=custom_objects)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\saving.py", line 627, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\layers\__init__.py", line 168, in deserialize
    printable_module_name='layer')
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object
    list(custom_objects.items())))
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\network.py", line 1056, in from_config
    process_layer(layer_data)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\network.py", line 1042, in process_layer
    custom_objects=custom_objects)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\layers\__init__.py", line 168, in deserialize
    printable_module_name='layer')
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 149, in deserialize_keras_object
    return cls.from_config(config['config'])
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\engine\base_layer.py", line 1179, in from_config
    return cls(**config)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\layers\core.py", line 875, in __init__
    self.activation = activations.get(activation)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\activations.py", line 227, in get
    return deserialize(identifier)
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\activations.py", line 208, in deserialize
    printable_module_name='activation function')
  File "C:\Users\cp\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 167, in deserialize_keras_object
    ':' + function_name)
ValueError: Unknown activation function:softmax_over_time

Please give me a hint how can I avoid it?

@rafaleo
Copy link
Author

rafaleo commented Mar 7, 2020

Found some way to walk around:
model = load_model("large_files/model.h5", custom_objects = {"softmax_over_time": softmax_over_time, "t":t})
just passed variable and function which is custom but this throws another error:

ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 1, 512), (None, 0, 100)]

I guess it's probably to re-write the function because it's not intended to use serialization.

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

1 participant