Skip to main content

ModelSpec

Struct ModelSpec 

Source
pub struct ModelSpec {
    pub name: String,
    pub task: ModelTask,
    pub source: ModelSource,
    pub files: Vec<ModelFileRequest>,
    pub metadata: BTreeMap<String, String>,
    pub repo_id: String,
    pub revision: String,
}
Expand description

Generic model spec.

Fields§

§name: String

Human-readable name for this value.

§task: ModelTask

The task value.

§source: ModelSource

The model source value.

§files: Vec<ModelFileRequest>

The files value.

§metadata: BTreeMap<String, String>

Caller-defined model metadata.

§repo_id: String
👎Deprecated:

use ModelSpec::source or ModelSpec::repo_id() instead

Deprecated compatibility field for Hugging Face model identifiers.

§revision: String
👎Deprecated:

use ModelSpec::source or ModelSpec::revision() instead

Deprecated compatibility field for Hugging Face revisions.

Implementations§

Source§

impl ModelSpec

Source

pub fn new(repo_id: impl Into<String>, task: ModelTask) -> Self

Creates a Hugging Face-backed model spec.

Source

pub fn from_source( name: impl Into<String>, task: ModelTask, source: ModelSource, ) -> Self

Creates a model spec from explicit source.

Source

pub fn repo_id_value(&self) -> Option<&str>

Returns the Hugging Face repo id when this spec has one.

Source

pub fn revision_value(&self) -> Option<&str>

Returns the revision when this spec has one.

Source

pub fn safe_name(&self) -> String

Returns a filesystem-safe model name segment.

Source

pub fn from_preset(preset: ModelPreset) -> Self

Builds this value from preset.

Source

pub fn name(self, value: impl Into<String>) -> Self

Returns name.

Source

pub fn revision(self, value: impl Into<String>) -> Self

Returns revision.

Source

pub fn file(self, path: impl Into<String>) -> Self

Returns file.

Source

pub fn optional_file(self, path: impl Into<String>) -> Self

Returns optional file.

Source

pub fn first_available_file( self, paths: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Returns first available file.

Source

pub fn cuda_oxide_plan( self, module_name: impl Into<String>, kernel_names: impl IntoIterator<Item = impl Into<String>>, ) -> CudaOxideModelPlan

Builds a cuda-oxide runtime plan for this model spec.

Trait Implementations§

Source§

impl Clone for ModelSpec

Source§

fn clone(&self) -> ModelSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModelSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ModelSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ModelSpec

Source§

impl PartialEq for ModelSpec

Source§

fn eq(&self, other: &ModelSpec) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ModelSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ModelSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V