Skip to content
Discussion options

You must be logged in to vote

The ort crate (which oar-ocr uses internally) does support PrepackedWeights for sharing weights across sessions. However:

  1. CPU-only limitation: ONNX Runtime only supports prepacked weights for the CPU execution provider
  2. Not exposed by oar-ocr: The oar-ocr library doesn't expose this low-level ort configuration

According to microsoft/onnxruntime#15301, the official recommendation is:

"You don't have to create multiple sessions for the same model; it's a huge waste of resources. Create only one session and reuse the same in different run threads."

A single session provides:

  • One thread pool
  • One memory allocator
  • One copy of weights
  • Thread-safe concurrent execution
[package]
name = "oaroc…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aianau
Comment options

Answer selected by aianau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants