Version: Latest

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:

WhatAWSAzureGoogle
Model StorageAmazon S3Azure Blob StorageGoogle 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: false
    volumes:
    - csi:
    driver: gcsfuse.csi.storage.gke.io
    readOnly: true
    volumeAttributes:
    bucketName: <YOUR BUCKET NAME>
    mountOptions: implicit-dirs,only-dir=<YOUR DIR IN YOUR BUCKET>
    name: rasa-models
    volumeMounts:
    - name: rasa-models
    mountPath: /app/models
    readOnly: true
    serviceAccount:
    # serviceAccount.create specifies whether a service account should be created.
    # set to false if you have already created the kubernetes service account
    create: true
    annotations:
    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:

helm upgrade \
--namespace <your namespace> \
--values values.yml \
<release name> \
rasa-<version>.tgz

And when the Rasa Pro pod restarts, it will load the model from the model storage.