Comments (9)
Apparently you need to specificy the seq_len
to export the RNN
=> save_net_to_onnx_file(Net *net, string path, int seq_len)
I'm testing more things. Once the issue is clear, I'll tell Simone so that he can do the python binding for you
from eddl.
I leave here the c++ version of your code, just in case more debugging is needed.
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include "eddl/apis/eddl.h"
#include "eddl/serialization/onnx/eddl_onnx.h" // Not allowed
using namespace eddl;
int main(int argc, char **argv) {
int epochs = 1;
int olength = 20;
int outvs = 2000;
int embdim = 32;
Net* net = download_resnet18(true, {3, 256, 256});
layer lreshape = getLayer(net, "top");
layer dense_layer = HeUniform(Dense(lreshape, 20, true, "out_dense"));
layer cnn_out = Sigmoid(dense_layer, "cnn_out");
layer concat = Concat({lreshape, cnn_out}, 0, "cnn_concat");
layer image_in = getLayer(net, "input");
layer ldecin = Input({outvs});
layer ldec = ReduceArgMax(ldecin, {0});
ldec = RandomUniform(
Embedding(ldec, outvs, 1, embdim, true), -0.05, 0.05
);
ldec = Concat({ldec, concat});
layer l1 = LSTM(ldec, 512, true);
layer out = Softmax(Dense(l1, outvs), 0, "out_cnn");
setDecoder(ldecin);
net = Model({image_in}, {out});
build(net,
adam(0.001), // Optimizer
{"soft_cross_entropy"}, // Losses
{"categorical_accuracy"}, // Metrics
CS_GPU({1}, 1, "full_mem"), // Computing service
true // Enable parameters initialization
);
summary(net);
Tensor* x_train = Tensor::randn({48, 256, 256, 3});
Tensor* y_train = Tensor::zeros({48,20, outvs});
x_train->permute_({0, 3, 1, 2});
y_train->set_select({":", ":", "0"}, 1.0);
fit(net, {x_train}, {y_train}, 6, epochs);
save(net, "img2text.bin", "bin");
///// ///// ///// ///// ///// ///// ///// ///// ///// /////
///// FIX: add the "seq_len" parameter => here, variable "length"
save_net_to_onnx_file(net, "img2text.onnx", length);
///// ///// ///// ///// ///// ///// ///// ///// ///// /////
cout << "Saved net to onnx file" << endl;
return 0;
}
=>
2.3661 secs/epoch
[ONNX::Export] Warning: The LSTM layer LSTM1 has mask_zeros=true. This attribute is not supported in ONNX, so the model exported will not have this attribute.
Saved net to onnx file
from eddl.
Apparently you need to specificy the
seq_len
to export the RNN =>save_net_to_onnx_file(Net *net, string path, int seq_len)
Thanks @salvacarrion : Jon suggested to use that parameter, but unfortunately it was missing in the Python API. Now it has been added, but I need to wait for the modification to appear on the distribution channels. I got his error for the first time with release 1.3: it has never occurred with previous ones.
from eddl.
Do you mind having a call on skype to make sure your exporting issue is fixed before doing the binding? I didn't understand a couple of things in the other issue
from eddl.
Replied. You have also a message on Skype. Thank you.
from eddl.
I need to wait for the modification to appear on the distribution channels
@thistlillo the Conda packages for pyeddl 1.3.1 have been made available two days ago
from eddl.
@simleo thank you, just updated the packages. I will post an update as soon as I launch a new training.
from eddl.
After the meeting, I think we can close this issue
from eddl.
I can confirm that after using EDDL version 1.3.1 and the seq_len
parameter the error has never occurred.
from eddl.
Related Issues (20)
- Fallback of unsupported args for ONNX
- Load dynamic inputs shapes from ONNX
- Add Tile layer and Broadcast HOT 1
- Allow asymmetric padding in ONNX
- Add the name_id of each layer
- Different training results with Keras and EDDL
- The examples should be intendeed for begineers, not for testing internals.
- Avoid printing to standard output HOT 1
- Support n-dimensional dense HOT 1
- Add preprocessor directives for FPGA
- Download model params are not consistent with keras.
- Problem in deserialization of an ONNX model HOT 1
- Segmentation fault in eddl.forward() with a LSTM layer HOT 3
- non-recurrent LSTM cells with multiple GPUs HOT 1
- Import ONNX file with a different input channel dimension HOT 1
- Import ONNX with low_memory setting HOT 1
- LSTM training fail on single GPU, but not with multiple GPUs HOT 4
- Import ONNX model from pytorch - LDense only works over 2D tensors (LDense) HOT 6
- Tensor manipulations HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eddl.