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
The Model.export() API in Keras 3 supports exporting to a TensorFlow SavedModel artifact for inference. When trying to export Gemma 2 and ShieldGemma to TF SavedModel, I ran into two different ValueErrors:
If no input_signature is provided, a ValueError will be thrown related to a structural mismatch between the expected and actual inputs passed to the GemmaCausalLM class; and
If an input_signature is provided as a list[keras.InputSpec], a ValueError will be thrown related the the wrong number of values being passed to a TF function.
However, if yo uwrap the dict from model.input in a list, as input_signature=[model.input], the export runs to completion.
Problem
The
Model.export()
API in Keras 3 supports exporting to a TensorFlow SavedModel artifact for inference. When trying to export Gemma 2 and ShieldGemma to TF SavedModel, I ran into two differentValueError
s:input_signature
is provided, aValueError
will be thrown related to a structural mismatch between the expected and actual inputs passed to theGemmaCausalLM
class; andinput_signature
is provided as alist[keras.InputSpec]
, aValueError
will be thrown related the the wrong number of values being passed to a TF function.However, if yo uwrap the
dict
frommodel.input
in alist
, asinput_signature=[model.input]
, the export runs to completion.This is not restricted to Gemma models, as shown in this minimal reproducible example.
Thanks to @mattdangerw for helping to isolate this minimal example.
The text was updated successfully, but these errors were encountered: