Trait ModelPaths

Source
pub trait ModelPaths:
    AsAny
    + Debug
    + Send
    + Sync {
    // Required methods
    fn get_weight_filenames(&self) -> &[PathBuf];
    fn get_config_filename(&self) -> &PathBuf;
    fn get_tokenizer_filename(&self) -> &PathBuf;
    fn get_template_filename(&self) -> &Option<PathBuf>;
    fn get_gen_conf_filename(&self) -> Option<&PathBuf>;
    fn get_preprocessor_config(&self) -> &Option<PathBuf>;
    fn get_processor_config(&self) -> &Option<PathBuf>;
    fn get_chat_template_explicit(&self) -> &Option<PathBuf>;
    fn get_adapter_paths(&self) -> &AdapterPaths;
}
Expand description

ModelPaths abstracts the mechanism to get all necessary files for running a model. For example LocalModelPaths implements ModelPaths when all files are in the local file system.

Required Methods§

Source

fn get_weight_filenames(&self) -> &[PathBuf]

Model weights files (multiple files supported).

Source

fn get_config_filename(&self) -> &PathBuf

Retrieve the PretrainedConfig file.

Source

fn get_tokenizer_filename(&self) -> &PathBuf

A serialised tokenizers.Tokenizer HuggingFace object.

Source

fn get_template_filename(&self) -> &Option<PathBuf>

File where the content is expected to deserialize to ChatTemplate.

Source

fn get_gen_conf_filename(&self) -> Option<&PathBuf>

Filepath for general model configuration.

Source

fn get_preprocessor_config(&self) -> &Option<PathBuf>

Get the preprocessor config (for the vision models). This is used to pre process images.

Source

fn get_processor_config(&self) -> &Option<PathBuf>

Get the processor config (for the vision models). This is primarily used for the chat template.

Source

fn get_chat_template_explicit(&self) -> &Option<PathBuf>

Get the explicit chat template.

Source

fn get_adapter_paths(&self) -> &AdapterPaths

Get adapter paths.

Implementors§