This Rust program demonstrates how to perform inference using an ONNX model for text classification.
Make sure you have Rust installed on your machine. You can install it by following the instructions on the official Rust website.
-
Clone the repository:
git clone https://github.com/AlaneLiang/ONNX-Model-Inference-with-Rust.git
-
Change into the project directory:
cd ONNX-Model-Inference-with-Rust
-
Build and run the program:
cargo run
You can modify the dict.json
file with your own word-to-index mapping and replace the model.onnx
file with your trained ONNX model. And you need to change the input vector shape according to your model input size.
src
: Contains the Rust source code files.dict.json
: JSON file containing the word-to-index mapping.model.onnx
: ONNX model file for text classification.
- Open Neural Network Exchange (ONNX): Open format for AI models.
- ndarray: N-dimensional arrays.
- serde: Serialization and deserialization framework for Rust.
This project is licensed under the MIT License - see the LICENSE file for details.