Models
module model.py
model.py
function calculate_model_size
calculate_model_size
Tells about the size of the model
Args:
model_dir
(str): directory in which model is present.
Returns:
total size of the model
class ModelVersion
ModelVersion
property created_at
Get the time at which model version was created
property created_by
Get the information about who created the model version
property description
Get description of the model
property fqn
Get fqn of the current model version
property metadata
Get metadata for the current model
property metrics
get the metrics for the current version of the model
property model_fqn
Get fqn of the model
property model_schema
get the model schema for current model
property name
Get the name of the model
property step
Get the step in which model was created
property updated_at
Get the information about when the model version was updated
property version
Get version information of the model
function delete
delete
Deletes the current instance of the ModelVersion hence deleting the current version.
Returns:
True if model was deleted successfully
Examples:
import truefoundry.ml as tfm
client = tfm.get_client()
model_version = client.get_model_version_by_fqn(fqn="<your-model-fqn>")
model_version.delete()
function download
download
Download a model file or directory to a local directory if applicable, and return a local path for it.
Args:
path
(str): Absolute path of the local filesystem destination directory to download the specified models. This directory must already exist. If unspecified, the models will either be downloaded to a new uniquely-named directory on the local filesystem or returned directly in the case of the Local ModelRepository.overwrite
(bool): If True it will overwrite the file if it is already present in the download directory else it will throw an error
Returns:
ModelVersionDownloadInfo
: Download Info instance containingmodel_dir
(path to downloaded model folder) and other metadata
Examples:
import truefoundry.ml as tfm
client = tfm.get_client()
model_version = client.get_model_version_by_fqn(fqn="<your-model-fqn>")
model_version.download(path="<your-desired-download-path>")
classmethod from_fqn
from_fqn
Get the version of a model to download contents or load them in memory
Args:
fqn
(str): Fully qualified name of the model version.
Returns:
ModelVersion
: An ModelVersion instance of the Model
Examples:
import truefoundry.ml as tfm
client = tfm.get_client()
model_version = tfm.ModelVersion.from_fqn(fqn="<your-model-fqn>")
function raw_download
raw_download
Download a model file or directory to a local directory if applicable, and return a local path for it.
Args:
path
(str): Absolute path of the local filesystem destination directory to download the specified models. This directory must already exist. If unspecified, the models will either be downloaded to a new uniquely-named directory on the local filesystem or returned directly in the case of the Local ModelRepository.overwrite
(bool): If True it will overwrite the file if it is already present in the download directory else it will throw an error
Returns:
path
: Absolute path of the local filesystem location containing the desired models.
Examples:
import truefoundry.ml as tfm
client = tfm.get_client()
model_version = client.get_model_version_by_fqn(fqn="<your-model-fqn>")
model_version.raw_download(path="<your-desired-download-path>")
function update
update
Updates the current instance of the ModelVersion hence updating the current version.
Examples:
import truefoundry.ml as tfm
client = tfm.get_client()
model_version = client.get_model_version_by_fqn(fqn="<your-model-fqn>")
model_version.description = 'This is the new description'
model_version.update()
Updated 7 months ago