- If it is possible then try to split the large model into multiple smaller sub models such that it under the memory limit of 2GB, then try to run each model sequentially by passing the output of one to the input of other.
- Also based on the error message it also seems that reshape is being used incorrectly used in the code, their might be the issue of particular ONNX network in its usage of reshape operation.
- If the problem persists, I suggest you reach out to MathWorks Technical Support here: https://www.mathworks.com/support/contact_us.html
importNetworkFromONNX error opening LLM
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to import an ONNX model into Matlab. First, I exported a Large Language Model (LLM) to ONNX from Hugging Face using the Optimum library. Next, I imported it into Matlab with the Deep Learning Toolbox Converter. However, during import I get the following error:
>> net = importNetworkFromONNX("model.onnx")
Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.
Error in nnet.internal.cnn.onnx.fcn.GraphTranslation/getInitializerValue (line 129)
data = reshape(data, dimVec); % Apply MATLAB shape
...
Error in importNetworkFromONNX (line 77)
Network = nnet.internal.cnn.onnx.importNetworkFromONNX(modelfile, varargin{:});
I think the issue has to do with the lack of support for the external data file which is required for models greater than 2GB. ONNX models are built on protobuf which has a 2 GB limit. When the model is greater than 2GB, ONNX separates the model weights into an external raw data file, called model.onnx_data. I've noted that that importNetworkFromONNX() doesn't even attempt to open the associated onnx_data file before it aborts.
How can we get large ONNX model support into Matlab? I've scowered the comments already and, for some reason, no one else has yet run into this issue.
thanks!
0 comentarios
Respuestas (1)
Ashutosh Thakur
el 22 de Dic. de 2023
Hi Joel,
I can understand that you are facing issues while importing ONNX model into MATLAB.
Here are the few suggestions which would help you:
I hope this helps!
Thanks.
1 comentario
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!