Persistent Volumes
Cerebrium gives you access to persistent volumes to store model weights and files. This volume persists across your project, meaning that if you refer to model weights or files created in a different app (but in the same project), you’re able to access them.
This allows model weights to be loaded in more efficiently, as well as reduce the size of your App container image.
How it works
Every Cerebrium Project comes with a 50GB volume by default. This volume is mounted on all apps as /persistent-storage
.
Uploading files
To upload files to your persistent volume, you can use the cerebrium cp local_path dest_path
command. This command copies files from your local machine to the specified destination path in the volume. The dest_path is optional; if not provided, the files will be uploaded to the root of the persistent volume.
Listing files
To list the files on your persistent volume, you can use the cerebrium ls [remote_path] command. This command lists all files and directories within the specified remote_path. If no remote_path is provided, it lists the contents of the root directory of the persistent volume.
Deleting files
To delete files or directories from your persistent volume, use the cerebrium rm remote_path
command. This command removes the specified file or directory from the persistent volume. Be careful, as this operation is irreversible.
Real world example
As a simple example, suppose you have an external SAM model that you want to use in your custom deployment. You can download it to a cache directory on your persistent volume. as such:
Now, in later inference requests, the model loads from the persistent volume instead of downloading again.