pub trait ModelPaths: AsAny + Debug {
Show 14 methods
// 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_adapter_filenames(&self) -> &Option<Vec<(String, PathBuf)>>;
fn get_adapter_configs(
&self,
) -> &Option<Vec<((String, String), LoraConfig)>>;
fn get_classifier_path(&self) -> &Option<PathBuf>;
fn get_classifier_config(&self) -> &Option<XLoraConfig>;
fn get_ordering(&self) -> &Option<Ordering>;
fn get_gen_conf_filename(&self) -> Option<&PathBuf>;
fn get_lora_preload_adapter_info(
&self,
) -> &Option<HashMap<String, (PathBuf, LoraConfig)>>;
fn get_preprocessor_config(&self) -> &Option<PathBuf>;
fn get_processor_config(&self) -> &Option<PathBuf>;
fn get_chat_template_json(&self) -> &Option<PathBuf>;
}
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§
sourcefn get_weight_filenames(&self) -> &[PathBuf]
fn get_weight_filenames(&self) -> &[PathBuf]
Model weights files (multiple files supported).
sourcefn get_config_filename(&self) -> &PathBuf
fn get_config_filename(&self) -> &PathBuf
Retrieve the PretrainedConfig
file.
sourcefn get_tokenizer_filename(&self) -> &PathBuf
fn get_tokenizer_filename(&self) -> &PathBuf
A serialised tokenizers.Tokenizer
HuggingFace object.
sourcefn get_template_filename(&self) -> &Option<PathBuf>
fn get_template_filename(&self) -> &Option<PathBuf>
File where the content is expected to deserialize to ChatTemplate
.
sourcefn get_adapter_filenames(&self) -> &Option<Vec<(String, PathBuf)>>
fn get_adapter_filenames(&self) -> &Option<Vec<(String, PathBuf)>>
Optional adapter files. (String, PathBuf)
is of the form (id name, path)
.
sourcefn get_adapter_configs(&self) -> &Option<Vec<((String, String), LoraConfig)>>
fn get_adapter_configs(&self) -> &Option<Vec<((String, String), LoraConfig)>>
Configuration of optional adapters. (String, String)
is of the form (id name, name)
.
sourcefn get_classifier_path(&self) -> &Option<PathBuf>
fn get_classifier_path(&self) -> &Option<PathBuf>
Filepath for the XLORA classifier
sourcefn get_classifier_config(&self) -> &Option<XLoraConfig>
fn get_classifier_config(&self) -> &Option<XLoraConfig>
XLoraConfig
for the XLORA classifier
sourcefn get_ordering(&self) -> &Option<Ordering>
fn get_ordering(&self) -> &Option<Ordering>
Return the defined ordering of adapters and layers within the model.
sourcefn get_gen_conf_filename(&self) -> Option<&PathBuf>
fn get_gen_conf_filename(&self) -> Option<&PathBuf>
Filepath for general model configuration.
sourcefn get_lora_preload_adapter_info(
&self,
) -> &Option<HashMap<String, (PathBuf, LoraConfig)>>
fn get_lora_preload_adapter_info( &self, ) -> &Option<HashMap<String, (PathBuf, LoraConfig)>>
Information for preloading LoRA adapters (adapter name, the weight file, and the config).
sourcefn get_preprocessor_config(&self) -> &Option<PathBuf>
fn get_preprocessor_config(&self) -> &Option<PathBuf>
Get the preprocessor config (for the vision models). This is used to pre process images.
sourcefn get_processor_config(&self) -> &Option<PathBuf>
fn get_processor_config(&self) -> &Option<PathBuf>
Get the processor config (for the vision models). This is primarily used for the chat template.
sourcefn get_chat_template_json(&self) -> &Option<PathBuf>
fn get_chat_template_json(&self) -> &Option<PathBuf>
Get the explicit chat template. If specified, this overwrites anything in the tokenizer_config.json