Use the uninstall_model function to uninstall the specified model from the user environment.
Required Argument
- model_name
- Specifies the name of the model to be uninstalled.
Optional Argument
- **kwargs
- Specifies the keyword arguments.
- suppress_output
Specifies whether to print the output message.
When set to True, the output message is not printed.
Default value is False.
- suppress_output
This function returns True if the operation is successful.
Example for Python environment
Example setup
- Create remote user environment.
>>> env = create_env("test_env", "python_3.8.13", "Test environment")User environment 'test_env' created.
- Define the model file.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'
- Install model from Hugging Face registry.
>>> env.install_model(model_name="google-bert/bert-base-uncased")
Request for install_model is completed successfully. Model 'google-bert/bert-base-uncased' installed successfully in the remote user environment 'test_env'.
- Install the model in the 'test_env' 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 766423af-7cc4-46db-8ee2-b6b5ded299c6 large_model.zip install_model Endpoint Generated 2023-11-09T09:21:24Z 1 766423af-7cc4-46db-8ee2-b6b5ded299c6 large_model.zip install_model File Uploaded 2023-11-09T09:22:28Z 2 766423af-7cc4-46db-8ee2-b6b5ded299c6 large_model.zip install_model File Installed 2023-11-09T09:22:30Z - List models.
>>> env.models
Model Size Timestamp 0 large_model 6144 2023-11-09T09:22:30Z
Example 1: Uninstall model from remote user environment
- Uninstall the model.
>>> env.uninstall_model('large_model')Model 'large_model' uninstalled successfully from the remote user environment 'test_env'. True
- Verify the uninstallation of model.
>>> env.models
No models found in remote user environment test_env.