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: StringHuman-readable name for this value.
task: ModelTaskThe task value.
source: ModelSourceThe 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
impl ModelSpec
Sourcepub fn new(repo_id: impl Into<String>, task: ModelTask) -> Self
pub fn new(repo_id: impl Into<String>, task: ModelTask) -> Self
Creates a Hugging Face-backed model spec.
Sourcepub fn from_source(
name: impl Into<String>,
task: ModelTask,
source: ModelSource,
) -> Self
pub fn from_source( name: impl Into<String>, task: ModelTask, source: ModelSource, ) -> Self
Creates a model spec from explicit source.
Sourcepub fn repo_id_value(&self) -> Option<&str>
pub fn repo_id_value(&self) -> Option<&str>
Returns the Hugging Face repo id when this spec has one.
Sourcepub fn revision_value(&self) -> Option<&str>
pub fn revision_value(&self) -> Option<&str>
Returns the revision when this spec has one.
Sourcepub fn from_preset(preset: ModelPreset) -> Self
pub fn from_preset(preset: ModelPreset) -> Self
Builds this value from preset.
Sourcepub fn optional_file(self, path: impl Into<String>) -> Self
pub fn optional_file(self, path: impl Into<String>) -> Self
Returns optional file.
Sourcepub fn first_available_file(
self,
paths: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn first_available_file( self, paths: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Returns first available file.
Sourcepub fn cuda_oxide_plan(
self,
module_name: impl Into<String>,
kernel_names: impl IntoIterator<Item = impl Into<String>>,
) -> CudaOxideModelPlan
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<'de> Deserialize<'de> for ModelSpec
impl<'de> Deserialize<'de> for ModelSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ModelSpec
impl StructuralPartialEq for ModelSpec
Auto Trait Implementations§
impl Freeze for ModelSpec
impl RefUnwindSafe for ModelSpec
impl Send for ModelSpec
impl Sync for ModelSpec
impl Unpin for ModelSpec
impl UnsafeUnpin for ModelSpec
impl UnwindSafe for ModelSpec
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