Open Nithanaroy opened 6 years ago
In fact the given lstm in source code also doesn't compile webgl and fallback descriptors. The error in the case of webgl looks the same as mine.
lstm (master)*$ python3.6 imdb_lstm.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
return f(*args, **kwds)
Use already trained model
Converting model into WebDNN format (graph descriptor)
$ python3.6 ../../bin/convert_keras.py output_keras/imdb_lstm.h5 --input_shape '(1,80)' --out output_keras --backend webgl,fallback
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
return f(*args, **kwds)
[convert_keras.py] Generating feedforward graph
2018-02-20 23:40:27.357091: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
[convert_keras.py] Generating graph descriptor
[convert_keras.py] BackendName: webgl
[convert_keras.py] Failed generating descriptor for webgl backend
Traceback (most recent call last):
File "../../bin/convert_keras.py", line 97, in main
graph_exec_data = generate_descriptor(backend, graph, constant_encoder_name=args.encoding)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/interface/generator.py", line 107, in generate_descriptor
return generator(graph, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/webgl/generator.py", line 92, in generate
return WebGLDescriptorGenerator.generate(graph, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/webgl/generator.py", line 61, in generate
kernels = cls.generate_kernels(graph)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/webgl/generator.py", line 84, in generate_kernels
raise NotImplementedError(f"[{cls.__name__}] Operator {op} is not handled by any generator handler")
NotImplementedError: [WebGLDescriptorGenerator] Operator <Embedding inputs={'x': <Variable Variable2 shape=(1, 80), order=[N, T]>, 'w': <ConstantVariable ConstantVariable0 shape=(20000, 128), order=[C, N]>}, outputs={'y': <Variable Variable3 shape=(1, 80, 128), order=[N, T, C]>}> is not handled by any generator handler
[convert_keras.py] BackendName: fallback
[convert_keras.py] Failed generating descriptor for fallback backend
Traceback (most recent call last):
File "../../bin/convert_keras.py", line 97, in main
graph_exec_data = generate_descriptor(backend, graph, constant_encoder_name=args.encoding)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/interface/generator.py", line 107, in generate_descriptor
return generator(graph, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/fallback/generator.py", line 75, in generate
return FallbackDescriptorGenerator.generate(graph, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/fallback/generator.py", line 64, in generate
kernels=cls.generate_kernels(graph, memory_layout),
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webdnn/backend/interface/generator.py", line 57, in generate_kernels
raise NotImplementedError(f"[{cls.__name__}] Operator {op} is not handled by any generator handler")
NotImplementedError: [FallbackDescriptorGenerator] Operator <Embedding inputs={'x': <Variable Variable2 shape=(1, 80), order=[N, T]>, 'w': <ConstantVariable ConstantVariable0 shape=(20000, 128), order=[C, N]>}, outputs={'y': <Variable Variable3 shape=(1, 80, 128), order=[N, T, C]>}> is not handled by any generator handler
Traceback (most recent call last):
File "imdb_lstm.py", line 130, in <module>
main()
File "imdb_lstm.py", line 124, in main
subprocess.check_call(convert_keras_command, shell=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'python3.6 ../../bin/convert_keras.py output_keras/imdb_lstm.h5 --input_shape '(1,80)' --out output_keras --backend webgl,fallback' returned non-zero exit status 1.
For a LSTM network created in Keras, I was able to convert keras model to webassembly and webgpu backends using bin/convert_keras.py
When I try to convert the same model to either fallback or webgl backends, it fails with this stacktrace: