Learn how to work with your Data Science models.
After you choose a project, click Models (Notebook Sessions is the default view).
From a Models view, you can:
Select a model to view all of its details and work with it.
Use the Actions icon (three dots) to view details, edit, move a model resource, or delete a model.
For Created By: and OCID:, you can use Show to see the full name of the user that created the notebook session. Use Copy to copy the name to your clipboard to use elsewhere.
Use the List Scope filter to view models associated with your selected project in another compartment.
Filter models by status using the Model State drop-down list. The default is to view all status types.
When there are tags applied to models, you can further filter models by clicking add or clear next to Tag Filters.
After you have trained a model, you can save it in your model catalog to centralize the storage of model artifacts and to be able to track model metadata. Use one of these methods for saving your model:
When you train a model in a notebook session, you can use the Accelerated Data Science (ADS) SDK to easily save models to the model catalog. ADS creates the model artifact on your behalf, captures all the relevant metadata like its provenance, and pushes a new model to the model catalog.
ADS also creates all the necessary files to deploy your model as an Oracle Function. An example is provided in the notebook in
As an authenticated user, import the ADS SDK:
from ads.common.model import ADSModel
Convert your estimator model object to an
ADSModelobject using the
from_estimator()method. Data Science supports a variety of model libraries including Sklearn (Scikit-learn), XGBoost , LightGBM, Keras, and TensorFlow.
adsmodel = ADSModel.from_estimator(<your_model_object>)
Prepare the model artifact with
ADS creates a local directory with all the model artifact files. The artifact is a ZIP archive of four files:
An inference script that is used to load the estimator object to memory and make predictions.
- (Optional) A serialized representation of your estimator object (most likely a pickle object).
A pip freeze list of all the Python library dependencies you need to run your model.
A description of the run-time environment of this model. We recommend that you use the file provided in the example template.
These four files are needed when you want to load the model in a different notebook session or if you want to recreate the model development environment on your local machine. The purpose of these files is to ensure that the model can be executed either in a notebook session environment or on a different machine.
prepare(), a user can also select to include the files necessary for a model deployment to Oracle Functions. This is possible using the optional argument
fn_artifact_files_included=True. Function files are available in the folder
fn-folder/in the model artifact file. You can find an example notebook session in
ads-examples/model_deployment.ipynb. It describes the steps to create the model artifact and deploy to Oracle Functions.
Also, you can see how to prepare and save a generic model object to the model catalog in the
After the artifact is prepared by ADS, you can save the model to the model
catalog using the
adsmodel.save()command with the proper arguments including the project and compartment OCIDs.
ADS extracts and fills in the model provenance information.
ADS packages these files into a ZIP archive and pushes the archive to the model catalog.
The maximum model artifact size that you can save using the ADS SDK is 2 GB.
When you are working inside a Git repository, ADS is able to pull your Git information and populate the model provenance metadata fields automatically for you:
- Git Repository URL
The URL of the remote repository.
- Git Commit
The commit hash.
- Git Branch
The name of the branch.
- Model Directory
The directory path where the model artifact was stored locally in your notebook session environment
- Training Script
The name of the file in which the
save()command was executed
Capturing model provenance is optional. However, capturing provenance follows best practices to ensure model reproducibility and auditability.
The information captured in model provenance allows for a user to retrieve the file and commit in which a particular model was trained. It is particularly useful when modifying an existing modeling pipeline, understanding how a particular model was generated, or auditing a model.
ADS cannot enforce a commit just before saving a model artifact. We recommend that you commit your code before saving models to the catalog.
If you are saving a model trained elsewhere, or simply want to use the console, this is how you can save a model:
Create a model artifact ZIP archive on your local machine by generating the
same four artifact files that ADS creates when calling
prepare_generic_model(<local_path>), and any other files needed to run your model, such as look-up CSV tables and custom Python modules.
- From the models list of your project, click Create Model.
- (Optional, but recommended) Enter a unique name and description for the model.
- Upload the model artifact archive (a ZIP file) by dragging and dropping the file into the Model Artifact section or clicking select a file to navigate to it.
- (Optional, but recommended) Enter the model provenance details.
- Click Create.
The maximum model artifact size that you can upload using the console is 100 MB. We strongly recommend that you use ADS to save larger models to the model catalog.
Viewing Model Details
You can either click the notebook session's name or the Actions icon (three dots), and click View Details to open the model details page.
You can either click the model's name or the Actions icon (three dots), and click Edit. You can change the name and description of the model and then save your changes.
You can either click the model's name or the Actions icon (three dots), and click Download Model Artifact to download the model artifact ZIP archive to your local machine.
Applying Tags to Models
You can either click the model's name or the Actions icon (three dots), and click Add Tags or the Tags tab.
You can apply both defined and free form tags to models using Working with Resource Tags.
Moving Model Resources
You can move a model resource from its current compartment to a different one.
For example, you may want to move a model to promote it from a development compartment to production compartment, or you could change the visibility of the model.
You can either click the model's name or the Actions icon (three dots), and click Move Resource. Select the destination compartment and click Move Resource.
You can either click the model's name or the Actions icon (three dots), and click Deactivate to mark an active model as inactive. You can reactivate it later.
You can either click the model's name or the Actions icon (three dots), and click Activate to mark an inactive models as active.
You can either click the model's name or the Actions icon (three dots), and click Delete to delete a model.
When you delete a model, its metadata and saved ZIP artifact are deleted and cannot be restored.
Using the API
For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.
Use the following operations to manage models: