Crates.io | ort-parallel |
lib.rs | ort-parallel |
version | 0.1.0 |
created_at | 2025-09-25 18:39:20.819471+00 |
updated_at | 2025-09-25 18:39:20.819471+00 |
description | A library for running ONNX models in parallel using ORT(session pool) |
homepage | |
repository | |
max_upload_size | |
id | 1854971 |
size | 24,208 |
This crate is just a session pool for ONNX Runtime. It will load more sessions with the same configuration & packed weights until the pool is full.
Sync
let builder = SessionBuilder::new()
.unwrap()
.with_optimization_level(ort::session::builder::GraphOptimizationLevel::Level3)
.unwrap();
let pool = SessionPool::commit_from_file(builder, Path::new("model.onnx"), 10).unwrap();
pool.run(inputs!{...}).unwrap();
Async
let builder = SessionBuilder::new()
.unwrap()
.with_optimization_level(ort::session::builder::GraphOptimizationLevel::Level3)
.unwrap();
let pool = AsyncSessionPool::commit_from_file(builder, Path::new("model.onnx"), 10).unwrap();
pool.load_all().await.unwrap();
pool.run_async(inputs! {...}, &RunOptions::new().unwrap())
.await
.unwrap();