Skip to main content

pc.get_model

pc.get_model(name=None, version=None, model_id=None)

Get the specified model and return as a model object. If neither name or model ID
is specified, an error will be thrown. If model ID is specified, name and version should
not be specified, else an error will be thrown. If just the model name is specified, the
most recent version will be returned.

Parameters:

   name: str
Name of model to get.

   version: Union[int, str]
Version of the specified model to get.

   model_id: str
ID of the model to get.

Returns:

   Model

Examples:

Get an already created model by name. Defaults to the latest version in the repository.

adapter = pc.get_model('My Finetuned Model Repo')

Get an already created model by model version

adapter = pc.get_model(name="My Finetuned Model Repo", version="3")

Get an already created model by ID.

pc.list_model_repos()
# >[ModelRepo(id=5678, model_name=Titanic Model, latest_config={...}, latest_dataset=Dataset(id=1234, name=Titanic Dataset, object_name=2bbf3f31fb2d, connection_id=0, author=jsmith, ...), selected_engine_id=2, ...),
# ModelRepo(id=2260, model_name=Fraud model, latest_config={...}, latest_dataset=Dataset(id=1235, name=Fraud Dataset, object_name=fraud, connection_id=1, author=jdoe, ...), selected_engine_id=1, ...)]

adapter = pc.get_model(model_id=5678)