caikit.runtime.model_management.directory_model_sizer
Attributes
Classes
DirectoryModelSizer. This class calculates a models size based on the |
Module Contents
- class caikit.runtime.model_management.directory_model_sizer.DirectoryModelSizer(config: aconfig.Config, instance_name: str)[source]
Bases:
caikit.runtime.model_management.model_sizer_base.ModelSizerBaseDirectoryModelSizer. This class calculates a models size based on the size of the files in the model directory
! Note: It caches the size of the directory after first sizing which can cause race conditions in certain situations.
- name = 'DIRECTORY'
This is the name of this constructible type that will be used by the factory to identify this class
- model_directory_size: Dict[str, int]
- get_model_size(model_id, local_model_path, model_type) int[source]
Returns the estimated memory footprint of a model Args:
model_id: The model identifier, used for informative logging cos_model_path: The path to the model archive in S3 storage model_type: The type of model, used to adjust the memory estimate
- Returns:
The estimated size in bytes of memory that would be used by loading this model
- __get_directory_size(model_id, local_model_path) int
Get the size of a directory