Use the install_model function to install a model from client machine to the remote user environment.
If model with same name already exists in the remote user environment, error is thrown.
Required Argument
- model_path
- Specifies absolute or relative path of the zip file containing model (including file name) to be installed in the remote user environment.Model file must be in zip format.
Optional Arguments
**kwargs: Specifies the keyword arguments.
- suppress_output
- Specifies whether to print the output message or not.
When set to True, then the output message is not printed. Default Value is False.
- asynchronous
- Specifies whether to install the file in remote user environment synchronously or asynchronously.
- timeout
- Specifies the time to wait in seconds for installing the file.
This function returns:
- Pandas DataFrame, whenmodel is installed synchronously and installation is completed before timeout.
- A string type 'claim_id' to track status when one of the following is true:
- Model is being installed asynchronously.
- Installation times out in synchronous execution mode.
Examples for Python environment
Example Prerequisite for examples 1-2
- Create remote user environment.
>>> env = create_env('testenv', 'python_3.9.13', 'Test environment')
User environment 'testenv' created.
- Define the model file.You must create a zip file containing all files related to model and use path to that zip file to install model using install_model API.
In this example, assume that all models files are zipped under 'large_model.zip'
>>> model = 'large_model.zip'
Example 1: Install the model in the 'testenv' environment
- Install the model.
The model file is installed sychronously by default.
>>> 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.
- Install the model asynchronously.
>>> 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.
- Check the status.
>>> 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