diff --git a/keras/api/_tf_keras/keras/saving/__init__.py b/keras/api/_tf_keras/keras/saving/__init__.py index 2f772922f8d..342fce2f3bc 100644 --- a/keras/api/_tf_keras/keras/saving/__init__.py +++ b/keras/api/_tf_keras/keras/saving/__init__.py @@ -4,6 +4,7 @@ since your modifications would be overwritten. """ +from keras.src.saving.file_editor import KerasFileEditor from keras.src.saving.object_registration import CustomObjectScope from keras.src.saving.object_registration import ( CustomObjectScope as custom_object_scope, diff --git a/keras/api/saving/__init__.py b/keras/api/saving/__init__.py index 2f772922f8d..342fce2f3bc 100644 --- a/keras/api/saving/__init__.py +++ b/keras/api/saving/__init__.py @@ -4,6 +4,7 @@ since your modifications would be overwritten. """ +from keras.src.saving.file_editor import KerasFileEditor from keras.src.saving.object_registration import CustomObjectScope from keras.src.saving.object_registration import ( CustomObjectScope as custom_object_scope, diff --git a/keras/src/saving/file_editor.py b/keras/src/saving/file_editor.py index 99a2f9bb011..cdaa1601757 100644 --- a/keras/src/saving/file_editor.py +++ b/keras/src/saving/file_editor.py @@ -7,6 +7,7 @@ import rich.console from keras.src import backend +from keras.src.api_export import keras_export from keras.src.saving import saving_lib from keras.src.saving.saving_lib import H5IOStore from keras.src.utils import naming @@ -31,6 +32,7 @@ def is_ipython_notebook(): return False +@keras_export("keras.saving.KerasFileEditor") class KerasFileEditor: """Utility to inspect, edit, and resave Keras weights files. @@ -97,10 +99,7 @@ def __init__( def summary(self): """Prints the weight structure of the opened file.""" - if is_ipython_notebook(): - self._weights_summary_iteractive() - else: - self._weights_summary_cli() + self._weights_summary_cli() def compare_to(self, reference_model): """Compares the opened file to a reference model. @@ -565,9 +564,6 @@ def _generate_html_weights(dictionary, margin_left=0, font_size=20): output = "Weights structure" output += _generate_html_weights(self.weights_dict) - if is_ipython_notebook(): - ipython.display.display(ipython.display.HTML(output)) - def get_weight_spec_of_saveable(saveable, spec, visited_saveables=None):