pub enum ModelSource {
ModelId(String),
ModelIdWithTransformer {
model_id: String,
transformer_model_id: String,
},
Dduf {
file: Cursor<Mmap>,
name: String,
},
}
Expand description
Source from which to load the model. This is easiest to create with the various constructor functions.
Variants§
Implementations§
source§impl ModelSource
impl ModelSource
sourcepub fn from_model_id<S>(model_id: S) -> ModelSourcewhere
S: ToString,
pub fn from_model_id<S>(model_id: S) -> ModelSourcewhere
S: ToString,
Load the model from a Hugging Face model ID or a local path.
sourcepub fn override_transformer_model_id<S>(
self,
model_id: S,
) -> Result<ModelSource, Error>where
S: ToString,
pub fn override_transformer_model_id<S>(
self,
model_id: S,
) -> Result<ModelSource, Error>where
S: ToString,
Load the transformer part of this model from a Hugging Face model ID or a local path.
For example, this enables loading a quantized transformer model (for instance, this) with the same base model as the original model ID.
use diffusion_rs_common::ModelSource;
let _ = ModelSource::from_model_id("black-forest-labs/FLUX.1-dev")
.override_transformer_model_id("sayakpaul/flux.1-dev-nf4-with-bnb-integration")?;
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelSource
impl RefUnwindSafe for ModelSource
impl Send for ModelSource
impl Sync for ModelSource
impl Unpin for ModelSource
impl UnwindSafe for ModelSource
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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