pub struct LoadOptions {
pub dtype: DType,
pub device: Device,
}Expand description
Device and dtype to load a model onto.
Defaults to F32, which is what every runner used before this existed.
Fields§
§dtype: DTypeElement type to materialise weights as.
device: DeviceDevice to place weights on.
Implementations§
Source§impl LoadOptions
impl LoadOptions
Sourcepub fn with_dtype(self, dtype: DType) -> Self
pub fn with_dtype(self, dtype: DType) -> Self
Override the dtype (builder style).
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Reject dtype/device combinations the backend cannot run.
candle’s CPU backend has no BF16 matmul, so a BF16 model on CPU fails
partway through loading or on the first forward pass with a bare
“unsupported dtype BF16 for op matmul”. Catching it here says what to do
instead (ferritin-100.9).
The refusal is scoped to the CPU backend rather than to the dtype
because Metal does run BF16: ferritin-100.19 loaded and ran both ESM2
and AMPLIFY there at BF16 without changing a single top-1 prediction.
See tests/test_plm_dtype_parity.rs for the divergence and throughput
tables that establish it. CUDA is assumed to behave like Metal here
and remains unmeasured — the tests cover whatever accelerator the build
actually has, so running them on a CUDA box is what closes that gap.
Trait Implementations§
Source§impl Clone for LoadOptions
impl Clone for LoadOptions
Source§fn clone(&self) -> LoadOptions
fn clone(&self) -> LoadOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LoadOptions
impl RefUnwindSafe for LoadOptions
impl Send for LoadOptions
impl Sync for LoadOptions
impl Unpin for LoadOptions
impl UnsafeUnpin for LoadOptions
impl UnwindSafe for LoadOptions
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,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more