Skip to content

Keras 3.0 load h5 model with Orthogonal initializer fails #19828

@newresu

Description

@newresu

Hi guys,

I'm trying to load an h5 model that was working in earlier versions.

  • This is a small part of the h5 file, where you can see (last part of the snippet) a recurrent initializer with a classname of Orthogonal.
{"name": "decoder_gru0", "class_name": "GRU", "config": {"name": "decoder_gru0", "trainable": true, "return_sequences": true, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "implementation": 0, "units": 488, "activation": "tanh", "recurrent_activation": "hard_sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "VarianceScaling", "config": {"scale": 1.0, "mode": "fan_avg", "distribution": "uniform", "seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}
  • The error returned is:
  File "..../keras/src/initializers/__init__.py", line 118, in get
    raise ValueError(
ValueError: Could not interpret initializer identifier: {'class_name': 'Orthogonal', 'config': {'gain': 1.0, 'seed': None}}

Addition

I then added the Orthogonal initializer to the custom objects, and it seems to go further, but gets stuck here:

    raise ValueError(
ValueError: Unrecognized keyword arguments passed to GRU: {'implementation': 0}

Any ideas on how to fix this @mehtamansi29 ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions