Skip to content

Commit bb340d6

Browse files
authored
Fix serialization of domain packages. (#20755)
Not all of their symbols are exported.
1 parent 7d4b7bb commit bb340d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

keras/src/saving/serialization_lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,8 @@ def _retrieve_class_or_fn(
783783

784784
# Otherwise, attempt to retrieve the class object given the `module`
785785
# and `class_name`. Import the module, find the class.
786-
if module == "keras.src" or module.startswith("keras.src."):
786+
package = module.split(".", maxsplit=1)[0]
787+
if package in {"keras", "keras_hub", "keras_cv", "keras_nlp"}:
787788
try:
788789
mod = importlib.import_module(module)
789790
obj = vars(mod).get(name, None)

0 commit comments

Comments
 (0)