View the Code
See the code for this example on Github.
Introduction
Mochi-1 is a state-of-the-art text-to-video model. This guide will help you deploy and use the model as a serverless API on Beam.Upload Model Weights
Before using the Mochi-1 model, you need to upload its weights to Beam. This is handled by theupload.py script:
Steps to Run the Script
Run the script locally to upload the weights:generate_video endpoint can access them for inference.
Setup Remote Environment
The model and its dependencies are defined in themochi_image. Here’s how it’s configured:
mochi_image includes all necessary Python packages and system dependencies:
Inference Function
Thegenerate_video function processes text prompts and generates a video: