Closed Ranxi closed 4 years ago
tensorflow_to_barracuda.py
supports only unmodified models produced by ML-Agents. In the latest Barracuda versions we added experimental LSTM support via ONNX importer right in the Unity Editor. Please let us know if it works for you.
@mantasp thanks, the tf2onnx tool in https://github.com/onnx/tensorflow-onnx works perfectly.
@mantasp Unfortunately, although I successfully convert my tf model to onnx model, I found that neither the direct importing of my onnx file into Unity Project nor the onnx_to_barracuda script could make it work in Unity.
The direct importing shows lots of errors: Unkown type encountered while parsing...
and Unsupported attribute axis...
and etc.
The onnx_to_barracuda script ignores the SCAN layer
which is common in LSTM Cells. Is there any chance to support the SCAN layer
within not so far future?
BTW, I also found some bugs when I tried to convert onnx to barracuda, that function get_tensor_data
( portal ) always treats the tensor.raw_data as float, while some raw_data are actually int64
.
Hey @Ranxi, were you ever able to resolve this? I'm running into the exact same problem where keras to onnx conversion works perfectly, but when I load it into Unity, I get errors like "unsupported attribute axis Softmax", etc.
Describe the bug I trained a TensorFlow model by myself. but right now, I want to transform it into a barracuda model, so it can run in Unity. However, I encountered a problem that seems to be a bug. It's an error when executing
G:\Unity_projects\ml-agents\ml-agents-0.11.0\ml-agents\mlagents\trainers\tensorflow_to_barracuda.py
line 476
.To Reproduce I have tried to reproduce it in example environments, but the thrown errors are not the same. So, I post the key snippet of my model here:
When I tried to convert the model to barracuda model, it threw this error:
I tried to reproduce it in the given example environments later, where I modified the function
create_recurrent_encoder()
in fileml-agents\ml-agents-0.11.0\ml-agents\mlagents\trainers\models.py
as follows:It got this error:
Console logs / stack traces For my own transformation, I turned on the verbose of
convert
function in filetensorflow_to_barracuda.py
and found:It seems that
var_tensors
intensorflow_to_barracuda.py: line 1381
should be:but it was listed into
const_tensors
. How to solve the problem? If you need more information, I'll put it here ASAP.Environment: