I was able to use tensorflow v2.15.0 (was using 2.8…x) and generate the onnx file by tweaking the dependencies as follows (install section)
install other dependencies
!pip install mutagen==1.47.0
!pip install torchinfo==1.8.0
!pip install torchmetrics==1.2.0
!pip install speechbrain==0.5.14
!pip install audiomentations==0.33.0
!pip install torch-audiomentations==0.11.0
!pip install acoustics==0.2.6
!pip uninstall tensorflow -y
!pip uninstall keras -y
!pip install keras==2.15.0
!pip install tensorflow-cpu==2.15.0
!pip install --upgrade tensorboard
!pip install --upgrade tensorflow-estimator
!pip install --upgrade google-auth-oauthlib
!pip install --upgrade tensorboard
!pip install onnx_tf==1.10.0
!pip install pronouncing==0.2.0
!pip install datasets==2.14.6
!pip install deep-phonemizer==0.0.19
However, with these new versions the conversion onnx > tflite fails
more specifically, line
convert_onnx_to_tflite(f"my_custom_model/{config[‘model_name’]}.onnx", f"my_custom_model/{config[‘model_name’]}.tflite")
fails with the following messages :
ValueError Traceback (most recent call last)
in <cell line: 1>()
----> 1 convert_onnx_to_tflite(f"my_custom_model/{config[‘model_name’]}.onnx", f"my_custom_model/{config[‘model_name’]}.tflite")
17 frames
/usr/local/lib/python3.10/dist-packages/tensorflow_probability/python/internal/prefer_static.py in _copy_docstring(original_fn, new_fn)
89 new_spec = tf_inspect.getfullargspec(new_fn)
90 if original_spec != new_spec:
—> 91 raise ValueError(
92 ‘Arg specs do not match: original={}, new={}, fn={}’.format(
93 original_spec, new_spec, original_fn))
ValueError: Arg specs do not match: original=FullArgSpec(args=[‘input’, ‘dtype’, ‘name’, ‘layout’], varargs=None, varkw=None, defaults=(None, None, None), kwonlyargs=, kwonlydefaults=None, annotations={}), new=FullArgSpec(args=[‘input’, ‘dtype’, ‘name’], varargs=None, varkw=None, defaults=(None, None), kwonlyargs=, kwonlydefaults=None, annotations={}), fn=<function ones_like_v2 at 0x79bb254d3010>
The Collab AI suggests the following
The error message Arg specs do not match
indicates a mismatch between the arguments of the original tf.ones_like
function and the new _ones_like
function defined in the tensorflow_probability
package.
To fix this issue, you need to ensure that the arguments of _ones_like
match those of tf.ones_like
. Specifically, the layout
argument should be removed from the _ones_like
function definition.
Any clue what is happening ? It looks like the # of arguments has changed with the TF version. I’m too noob to propose any change to the existing code but has anyone been able to correct that ?
Thanks