You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keras provides a key-word argument line_break to the provided print_fn when outputting the model summary which neptune does not currently handle
Reproduction
When keras is given a print_fn, print_summary() will provide a key-word argument line_break see here. The lambda function created in neptune only handles a single positional argument: Neptune Code Here
I have handled this by modifying the lambda function locally: model.summary(print_fn=lambda x: stream.write(x + '\n')) -> model.summary(print_fn=lambda x, **kwargs: stream.write(x + '\n'))
Expected behavior
StreamIO object to capture the model summary
Traceback
{
"name": "TypeError",
"message": "_model_summary_file.<locals>.<lambda>() got an unexpected keyword argument 'line_break'",
"stack": "---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File ~/anaconda3/envs/env/lib/python3.11/site-packages/keras_core/src/utils/traceback_utils.py:123, in filter_traceback.<locals>.error_handler(*args, **kwargs)
120 filtered_tb = _process_traceback_frames(e.__traceback__)
121 # To get the full stack trace, call:
122 # `keras_core.config.disable_traceback_filtering()`
--> 123 raise e.with_traceback(filtered_tb) from None
124 finally:
125 del filtered_tb
File ~/anaconda3/envs/env/lib/python3.11/site-packages/neptune_tensorflow_keras/impl/__init__.py:157, in NeptuneCallback.on_train_end(self, logs)
154 def on_train_end(self, logs=None):
155 # We need this to be logged at the end of the training, otherwise we are risking this to happen:
156 # https://stackoverflow.com/q/55908188/3986320
--> 157 self._model_logger[\"summary\"] = _model_summary_file(self.model)
159 if self._log_model_diagram:
160 self._model_logger[\"visualization\"] = _model_diagram(self.model)
File ~/anaconda3/envs/env/lib/python3.11/site-packages/neptune_tensorflow_keras/impl/__init__.py:182, in _model_summary_file(model)
180 def _model_summary_file(model) -> File:
181 stream = io.StringIO()
--> 182 model.summary(print_fn=lambda x: stream.write(x + \"\
\"))
183 return File.from_stream(stream, extension=\"txt\")
TypeError: _model_summary_file.<locals>.<lambda>() got an unexpected keyword argument 'line_break'"
}
Describe the bug
Keras provides a key-word argument
line_break
to the providedprint_fn
when outputting the model summary which neptune does not currently handleReproduction
When keras is given a
print_fn
,print_summary()
will provide a key-word argumentline_break
see here. The lambda function created in neptune only handles a single positional argument:
Neptune Code Here
I have handled this by modifying the lambda function locally:
model.summary(print_fn=lambda x: stream.write(x + '\n'))
->model.summary(print_fn=lambda x, **kwargs: stream.write(x + '\n'))
Expected behavior
StreamIO object to capture the model summary
Traceback
Environment
The output of
pip list
:The operating system you're using:
MacOS 14.0
The output of
python --version
:Python 3.11
Additional context
Using keras_core to use torch backend rather than tensorflow
The text was updated successfully, but these errors were encountered: