This tutorial will show you how to migrate a Cog Hello World app to Beam.
yaml
, whereas the interface for Beam is pure Python.
Beam’s custom container runtime is the magic behind fast cold-start. In addition, Beam provides other utilities for developers building AI apps, like the ability to cache models in storage volumes and run development previews.
You don’t need Docker to use Beam. The only requirement is having the Beam CLI and SDK installed.
predict.py
, which is the entry-point to your model, and a cog.yaml
which defines the libraries and dependencies to package with your app.
With Beam, your predict.py
and cog.yaml
will be combined into the same Python file.
predict.py
predict.py
portion of the Cog to use Beam primitives.
This is the original predict.py
file:
predict.py
to Beam, create a new Python file. You can call it whatever you want, but for this example, we will name it app.py
.
cog.yaml
cog.yaml
to the app.py
file with your Beam app:
Image
class.
cog.yaml
looks like this:
python_packages
and commands
field in Image()
: