Model Storage Bucket
This page explains how to load a model into a Rasa Pro container running on Kubernetes/Openshift using a Model Storage bucket.
Prerequisite: Model Storage bucket
In your cloud, you first must set up a Model Storage bucket:
What | AWS | Azure | |
---|---|---|---|
Model Storage | Amazon S3 | Azure Blob Storage | Google Cloud Storage |
Upload your trained model
It is recommended that you use a CI/CD pipeline to train, test and upload your Rasa Pro model to this Model Storage bucket.
Configuration
Rasa needs to be able to access the Model Storage bucket, which works different on each Cloud Platform, and each platform has multiple options. We describe here one of the methods for configuring it on Google Cloud Platform.
A recommended approach in Google Cloud is to use the Cloud Storage FUSE CSI driver.
This allows you to mount Cloud Storage buckets as a file system, avoiding the use of cloud-specific APIs.
Follow the steps of Enable the Cloud Storage FUSE CSI driver
Follow the steps of Create a IAM service account key and ensure the service account has read/write/create access to your Cloud Storage bucket.
Set up the IAM policy binding for the rasa-pro-sa Kubernetes service account
gcloud iam service-accounts add-iam-policy-binding \<YOUR SERVICE ACCOUNT EMAIL> \--role roles/iam.workloadIdentityUser \--member "serviceAccount:<YOUR PROJECT_ID>.svc.id.goog[<YOUR NAMESPACE>/rasa-pro-sa]"This binding will allow the Kubernetes service account to act as the IAM service account.
NOTE: You do not need to the rasa-pro-sa Kubernetes service account first. It will be created when you deploy it with the values in the next step.
Update your values.yml file to mount your Model Storage bucket to Rasa:
rasa:endpoints:models:enabled: falsevolumes:- csi:driver: gcsfuse.csi.storage.gke.ioreadOnly: truevolumeAttributes:bucketName: <YOUR BUCKET NAME>mountOptions: implicit-dirs,only-dir=<YOUR DIR IN YOUR BUCKET>name: rasa-modelsvolumeMounts:- name: rasa-modelsmountPath: /app/modelsreadOnly: trueserviceAccount:# serviceAccount.create specifies whether a service account should be created.# set to false if you have already created the kubernetes service accountcreate: trueannotations:iam.gke.io/gcp-service-account: <YOUR SERVICE ACCOUNT EMAIL>name: "rasa-pro-sa"podAnnotations:gke-gcsfuse/volumes: "true"
Deploy
To update the helm deployment, you can use:
And when the Rasa Pro pod restarts, it will load the model from the model storage.