MycroftAI / mycroft-precise

A lightweight, simple-to-use, RNN wake word listener
Apache License 2.0
818 stars 228 forks source link

Convert Or listen model #245

Open thatsri9ht opened 4 months ago

thatsri9ht commented 4 months ago

Hello, I've trained a model in Google Colab. However, when attempting to convert or use the model in either Colab or Ubuntu, I encounter an error. I need assistance with fixing this issue.

!python -m precise.scripts.convert /content/drive/MyDrive/mycroft-precise/nili.net

/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) Using TensorFlow backend. WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/content/drive/MyDrive/mycroft-precise/precise/scripts/convert.py", line 91, in main() File "/content/drive/MyDrive/mycroft-precise/precise/scripts/base_script.py", line 49, in run_main script.run() File "/content/drive/MyDrive/mycroft-precise/precise/scripts/convert.py", line 39, in run self.convert(args.model, args.out.format(model=model_name)) File "/content/drive/MyDrive/mycroft-precise/precise/scripts/convert.py", line 60, in convert model = load_precise_model(model_path) File "/content/drive/MyDrive/mycroft-precise/precise/model.py", line 54, in load_precise_model return load_keras().models.load_model(model_name) File "/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 419, in load_model model = _deserialize_model(f, custom_objects, compile) File "/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 251, in _deserialize_model if weight_names: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

for ubuntu:

precise-listen and precise-convert:

Converting nili_alldata8ep.net to nili_alldata8ep.pb ... Using TensorFlow backend. Traceback (most recent call last): File "/home/user/Desktop/mycroft/.venv/bin/precise-convert", line 33, in sys.exit(load_entry_point('mycroft-precise', 'console_scripts', 'precise-convert')()) File "/home/user/Desktop/mycroft/precise/scripts/base_script.py", line 49, in run_main script.run() File "/home/user/Desktop/mycroft/precise/scripts/convert.py", line 39, in run self.convert(args.model, args.out.format(model=model_name)) File "/home/user/Desktop/mycroft/precise/scripts/convert.py", line 60, in convert model = load_precise_model(model_path) File "/home/user/Desktop/mycroft/precise/model.py", line 54, in load_precise_model return load_keras().models.load_model(model_name) File "/home/user/Desktop/mycroft/.venv/lib/python3.7/site-packages/keras/models.py", line 243, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "/home/user/Desktop/mycroft/.venv/lib/python3.7/site-packages/keras/models.py", line 317, in model_from_config return layer_module.deserialize(config, custom_objects=custom_objects) File "/home/user/Desktop/mycroft/.venv/lib/python3.7/site-packages/keras/layers/init.py", line 55, in deserialize printable_module_name='layer') File "/home/user/Desktop/mycroft/.venv/lib/python3.7/site-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object list(custom_objects.items()))) File "/home/user/Desktop/mycroft/.venv/lib/python3.7/site-packages/keras/models.py", line 1367, in from_config if 'class_name' not in config[0] or config[0]['class_name'] == 'Merge': KeyError: 0