#[non_exhaustive]pub struct InitOptionsUserDefined {
pub environment: Option<Environment>,
pub execution_providers: Vec<ExecutionProviderDispatch>,
pub max_length: usize,
pub intra_threads: Option<usize>,
pub disable_cpu_fallback: bool,
pub dimension_overrides: Vec<(String, i64)>,
pub session_config: Vec<(String, String)>,
pub auto_device: Option<AutoDevicePolicy>,
}onnx only.Expand description
Options for initializing a user-defined embedding model.
Model files are held by the UserDefinedEmbeddingModel struct
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.environment: Option<Environment>§execution_providers: Vec<ExecutionProviderDispatch>§max_length: usize§intra_threads: Option<usize>Number of intra-op threads for ONNX Runtime. None (the default) uses
every available CPU core via std::thread::available_parallelism.
Set this to cap CPU usage (e.g. on laptops) at the cost of throughput.
disable_cpu_fallback: boolRefuse session creation when any graph node would fall back to the CPU execution provider. This is useful for accelerator conformance tests and for applications where silent partial placement is incorrect.
dimension_overrides: Vec<(String, i64)>Override named free dimensions before ORT optimizes and places the graph. Static-shape execution providers such as QNN can use this with one user-defined model session per admitted shape.
session_config: Vec<(String, String)>ONNX Runtime session configuration entries, applied with
SessionBuilder::with_config_entry. Use this for settings that have
no dedicated builder method, such as mlas.disable_kleidiai.
auto_device: Option<AutoDevicePolicy>Policy for ONNX Runtime’s automatic execution provider selection,
applied with SessionBuilder::with_auto_device. None (the default)
keeps ort’s default, AutoDevicePolicy::MaxEfficiency, which registers
CoreML on macOS. Some(AutoDevicePolicy::PreferCPU) never registers an
execution provider automatically. Execution providers passed through
execution_providers take precedence over automatic selection.
Implementations§
Source§impl InitOptionsUserDefined
impl InitOptionsUserDefined
pub fn new() -> Self
pub fn with_environment(self, environment: Environment) -> Self
pub fn with_execution_providers( self, execution_providers: Vec<ExecutionProviderDispatch>, ) -> Self
pub fn with_max_length(self, max_length: usize) -> Self
Sourcepub fn with_intra_threads(self, intra_threads: usize) -> Self
pub fn with_intra_threads(self, intra_threads: usize) -> Self
Set the number of intra-op threads ONNX Runtime uses. By default
(None) all available CPU cores are used. Capping this limits CPU
usage at the cost of per-inference throughput.
pub fn with_disable_cpu_fallback(self, disable: bool) -> Self
pub fn with_dimension_override(self, name: impl Into<String>, size: i64) -> Self
Sourcepub fn with_session_config(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_session_config( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add an ONNX Runtime session configuration entry, applied with
SessionBuilder::with_config_entry. Call it once per entry.
Example: .with_session_config("mlas.disable_kleidiai", "1").
Sourcepub fn with_auto_device(self, policy: AutoDevicePolicy) -> Self
pub fn with_auto_device(self, policy: AutoDevicePolicy) -> Self
Set the policy for ONNX Runtime’s automatic execution provider
selection, applied with SessionBuilder::with_auto_device.
Example: .with_auto_device(AutoDevicePolicy::PreferCPU) keeps every
node on the CPU when no execution provider is registered explicitly.
Trait Implementations§
Source§impl Clone for InitOptionsUserDefined
impl Clone for InitOptionsUserDefined
Source§impl Debug for InitOptionsUserDefined
impl Debug for InitOptionsUserDefined
Source§impl Default for InitOptionsUserDefined
impl Default for InitOptionsUserDefined
Source§impl From<InitOptionsWithLength<EmbeddingModel>> for InitOptionsUserDefined
Convert InitOptions to InitOptionsUserDefined
impl From<InitOptionsWithLength<EmbeddingModel>> for InitOptionsUserDefined
Convert InitOptions to InitOptionsUserDefined
This is useful for when the user wants to use the same options for both the default and user-defined models
Source§fn from(options: TextInitOptions) -> Self
fn from(options: TextInitOptions) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for InitOptionsUserDefined
impl !UnwindSafe for InitOptionsUserDefined
impl Freeze for InitOptionsUserDefined
impl Send for InitOptionsUserDefined
impl Sync for InitOptionsUserDefined
impl Unpin for InitOptionsUserDefined
impl UnsafeUnpin for InitOptionsUserDefined
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().