This article is a mirror article of machine translation, please click here to jump to the original article.

View: 1666|Reply: 2

Use Onnx model inference to warn of CleanUnusedInitializersAndNodeArgs issues

[Copy link]
Posted on 2025-1-9 09:44:15 | | |
Requirements: When using C# to load onnx model inference, the warning is as follows.

:Graph::CleanUnusedInitializersAndNodeArgs] Removing initializer '103'. It is not used by any node and should be removed from the model.



Solution:

1. Create a python environment and install dependencies with the following commands:



2. Create a new CleanUnusedInitializersAndNodeArgs.py script as follows:



  • extract_constant_to_initializer: Convert constant nodes to initiators to reduce the number of nodes in the computation graph and improve inference efficiency.
  • eliminate_unused_initializer: Remove unused initiators to reduce model size and improve loading and inference speed.


Place the .onnx model file and .py script under the same folder and execute the following command:



Script download: CleanUnusedInitializersAndNodeArgs.py (631 Bytes, Number of downloads: 0, 售价: 5 粒MB)
(End)




Previous:Use Onnx model inference to warn remove_initializer_from_input issues
Next:Git lfs large file versioning control
 Landlord| Posted on 2025-1-9 09:44:50 |
Use Onnx model inference to warn remove_initializer_from_input issues
https://www.itsvse.com/thread-10917-1-1.html
 Landlord| Posted on 2025-1-9 09:48:59 |
Synthesize a script
merge.py (1.07 KB, Number of downloads: 0)



Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com