Teradata Package for Python Function Reference on VantageCloud Lake - install_model - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference on VantageCloud Lake
- Deployment
- VantageCloud
- Edition
- Lake
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.scriptmgmt.UserEnv.UserEnv.install_model = install_model(self, model_path, **kwargs)
- DESCRIPTION:
Function installs a model from client machine to the remote
user environment created in Vantage Languages Ecosystem. If
model with same name already exists in the remote user
environment, error is thrown.
Note:
Maximum size of the model should be lessthan or equal to 5GB.
PARAMETERS:
model_path:
Required Argument.
Specifies absolute or relative path of the zip file containing
model (including file name) to be installed in the remote user
environment.
Note:
Model file should be in zip format.
Types: str
**kwargs:
Specifies the keyword arguments.
suppress_output:
Optional Argument.
Specifies whether to print the output message or not.
When set to True, then the output message is not printed.
Default Value: False
Types: bool
asynchronous:
Optional Argument.
Specifies whether to install the model in remote user environment
synchronously or asynchronously. When set to True, model is installed
asynchronously. Otherwise, model is installed synchronously.
Default Value: False
Types: bool
timeout:
Optional Argument.
Specifies the time to wait in seconds for installing the model.
If the model is not installed with in "timeout" seconds, the
function returns a claim-id and one can check the status using
the claim-id. If "timeout" is not specified, then there is no
limit on the wait time.
Note:
Argument is ignored when "asynchronous" is True.
Types: int OR float
RETURNS:
Pandas DataFrame when model is installed synchronously and installation
is completed before timeout.
claim_id, to track status, when model is getting installed asynchronously
or installation times out in synchronous execution mode.
RAISES:
TeradataMlException.
EXAMPLES:
# Create remote user environment.
>>> env = create_env('testenv', 'python_3.9.13', 'Test environment')
User environment 'testenv' created.
# User should create a zip file containing all files related to model
# and use path to that zip file to install model using install_model()
# API. Let's assume that all models files are zipped under 'large_model.zip'
>>> model = 'large_model.zip'
# Example 1: Install the model in the 'testenv' environment.
>>> env.install_model(model_path = model)
Request for install_model is completed successfully.
Claim Id File/Libs/Model Method Name Stage Timestamp Additional Details
0 3fe99ef5-cc5b-41c6-92a4-595d60ecfbb5 large_model.zip install_model Endpoint Generated 2023-10-30T12:04:40Z
1 3fe99ef5-cc5b-41c6-92a4-595d60ecfbb5 large_model.zip install_model File Uploaded 2023-10-30T12:05:37Z
2 3fe99ef5-cc5b-41c6-92a4-595d60ecfbb5 large_model.zip install_model File Installed 2023-10-30T12:05:39Z
# Verify the model installation.
>>> env.models
Model Size Timestamp
0 large_model 6144 2023-10-30T13:11:00Z
# Example 2: Install the model asynchronously and check the
# status of installation.
>>> claim_id = env.install_model(model_path = model, asynchronous=True)
Model installation is initiated. Check the status using status() with the claim id 7e840c47-3d70-4a11-a079-698203603854.
>>> env.status(claim_id)
Claim Id File/Libs/Model Method Name Stage Timestamp Additional Details
0 7e840c47-3d70-4a11-a079-698203603854 large_model.zip install_model Endpoint Generated 2023-10-30T13:32:52Z
1 7e840c47-3d70-4a11-a079-698203603854 large_model.zip install_model File Uploaded 2023-10-30T13:34:02Z
2 7e840c47-3d70-4a11-a079-698203603854 large_model.zip install_model File Installed 2023-10-30T13:34:03Z
# Verify the model installation.
>>> env.models
Model Size Timestamp
0 large_model 6144 2023-10-30T13:34:03Z