Uploading a trained model
This guide describes how to upload a trained machine learning (ML) model on AI Hub.
About uploading and sharing assets on AI Hub
You must sign in with a user account that is associated with a Cloud Identity or Google Workspace domain to upload and share assets on AI Hub. Assets that you upload to AI Hub are not shared by default. You can share these assets with individuals, groups, or your entire organization.
You are responsible for the assets that you upload on AI Hub. Follow your organization's guidelines and policies when uploading and sharing assets on AI Hub. Do not store credentials on AI Hub.
Prepare your trained model for publication
Before you can upload a model on AI Hub, you must export your trained model for predictions and compress it as a zip file.
Follow these steps to prepare your model for publication:
TensorFlow
- Follow the AI Platform guide to deploying models to learn how to prepare and export your model for predictions.
- Compress the exported version of your model files as a zip file.
scikit-learn
Export your model with the pickle or joblib library. Your saved model file must be named either
model.pkl
ormodel.joblib
, depending on which library you used.Library used to export model Correct model name pickle
model.pkl
joblib
model.joblib
Compress the exported version of your model files as a zip file.
XGBoost
Export your model with the xgboost.Booster, pickle, or joblib library. Your saved model file must be named
model.pkl
,model.joblib
, ormodel.bst
, depending on which library you used.Library used to export model Correct model name xgboost.Booster
model.bst
pickle
model.pkl
joblib
model.joblib
Compress the exported version of your model files as a zip file.
Upload a trained model on AI Hub
Follow these steps to upload your trained model on AI Hub:
- Go to AI Hub. Click Sign in in the upper-right corner of the window and follow the prompts to sign in with an account that is associated with your organization.
- Click Upload and select Trained Model from the list. A form opens, prompting you for information about the model that you want to upload.
Supply the following information in the Metadata section:
- Model name: A short description that helps you identify your model on AI Hub.
- Input data type: Select the types of data that your model processes. This metadata is useful for people who search AI Hub for models that work for their type of data.
- ML Workflow: (Optional.) Select the steps in the ML workflow that characterize your model. This metadata is useful for people who search AI Hub for assets that implement a specific ML workflow step. For example, a model that converts a string to word vectors could be used for data preparation or predictions, in that case select the Data preparation and Deploying workflow steps.
- Technique: (Optional.) Select the ML methodologies that were used to implement this model. This metadata is useful for people who search AI Hub for assets that implement a specific ML technique.
- Use case: (Optional.) Select the scenarios that characterize your model. This metadata is useful for people who search AI Hub for assets that fulfill a specific use case.
- Labels: (Optional.) Enter key terms that characterize your model. This metadata is useful for people who search AI Hub for assets with a specific label.
- Summary: A description of the functionality that your model implements.
Click Next.
Supply the following information in the Version section:
- Version: This field offers a way for you to name and manage the
versions of your model. A good first version number is:
1
. - Model .zip file: Click Upload and follow the prompts to
upload the
model.zip
file which you created in an earlier step of this guide. - Python version: Select the version of Python that was used to create this model.
- ML Framework: Select the ML framework that was used to create this model.
- ML Framework version: Select the version of the ML framework that was used to create this model.
- Version: This field offers a way for you to name and manage the
versions of your model. A good first version number is:
Click Next.
In the Documentation section, follow the instructions in the documentation template to describe your model. You can use Markdown to format your documentation.
Click the Preview Changes tab to see the documentation rendered as HTML.
Click Next.
Check the information in the Review and finish section. If you need to change something, click one of the other sections and update the information, then return to the Review and finish section.
Click Publish to upload the trained model to your private assets on AI Hub.
Change a model's metadata
Follow this process to update a trained model's metadata, or to add a new version of a trained model:
- Go to AI Hub.
- Click My assets. A page opens, listing the assets that you have uploaded.
- Find the model that you would like to update, then click the model's name. A form opens, prompting you for information about the model.
Update the information in the Metadata section:
- Model name: A short description that helps you identify your model on AI Hub.
- Input data type: Select the types of data that your model processes. This metadata is useful for people who search AI Hub for assets that work for their type of data.
- ML Workflow: (Optional.) Select the steps in the ML workflow that characterize your model. This metadata is useful for people who search AI Hub for assets that implement a specific ML workflow step. For example, a model that converts a string to word vectors could be used for data preparation or predictions, in that case select the Data preparation and Deploying workflow steps.
- Technique: (Optional.) Select the ML methodologies that were used to implement this model. This metadata is useful for people who search AI Hub for assets that implement a specific ML technique.
- Use case: (Optional.) Select the scenarios that characterize your model. This metadata is useful for people who search AI Hub for assets that fulfill a specific use case.
- Labels: (Optional.) Enter key terms that characterize your model. Use commas to separate terms. This metadata is useful for people who search AI Hub for assets with a specific label.
- Summary: A description of the functionality that your model implements.
Click Next. The Version section lists the published versions of this model.
To add a new version of this model, click Add New Version and supply the following information:
- Version: This field offers a way for you to name and manage the versions of your model. This field is preset to your model's next version number.
- Model .zip file: Click Upload and follow the prompts to upload
your model's new
model.zip
file, which you created in an earlier step of this guide. - Python version: Select the version of Python that was used to create this model.
- ML Framework: Select the ML framework that was used to create this model.
- ML Framework version: Select the version of the ML framework that was used to create this model.
Click Next.
Review and update the Documentation for your model. You can use Markdown to format your documentation.
Click the Preview Changes tab to see the documentation rendered as HTML.
Click Next.
Check the information in the Review and finish section. If you need to change something, click one of the other sections and update the information, then return to the Review and finish section.
Click Publish to save your changes.
What's next
- Learn how to use a trained model from AI Hub.
- Learn more about sharing assets with your colleagues on AI Hub.
- Understand important concepts and terms by reading the introduction to AI Hub.