Explore Docs Blog Sign in Join the waitlist


Learn how to package a trained model using Cog and publish it to Replicate.



  • A trained model. If you don't already have your own trained model, you can use one from replicate/cog-examples.
  • macOS or Linux. You'll be using the Cog command-line tool to build and push your model. Cog works on macOS and Linux, but does not currently support Windows.
  • Docker. Cog uses Docker to create a container for your model. You'll need to install Docker before you can run Cog.

Create a Replicate account

Before you can publish your model, you'll need a Replicate account. Replicate is currently in closed beta while we iron out the wrinkles. If you have a beta invite link you can use that to sign up. If you don't have a beta invite, come talk to us in Discord or send an email to team@replicate.com.

Create a model page

Next you'll create a page for your model on Replicate. Visit replicate.com/create to choose a name for your model, and specify whether it should be public or private.

Install Cog

Cog makes it easy to put a machine learning model in a Docker container.

$ sudo curl -o /usr/local/bin/cog -L https://github.com/replicate/cog/releases/latest/download/cog_`uname -s`_`uname -m`
$ sudo chmod +x /usr/local/bin/cog

More information about Cog and its full documentation are on GitHub.

Configure your model

To configure your project for use with Cog, you'll need to add two files:

  • cog.yaml defines system requirements, Python package dependencies, etc
  • predict.py describes the prediction interface for your model

Use the cog init command to generate these files in your project:

$ cd path/to/your/model
$ cog init

For more details on how to configure these files, follow this guide to setting up Cog for your model.

You might also find these references useful:

Push your model

Now that you've configured your model for use with Cog, it's time to publish it to the Replicate registry:

$ cog login
$ cog push r8.im/your-username/your-model

Note: You can also set the image property in your cog.yaml file. This allows you to run cog push without specifying the image, and also makes your Replicate model page more discoverable for folks reading your model's source code.

Run predictions

Once you've pushed your model to the registry it will be visible on the website, and you can use the web-based form to run predictions using your model. Whenever you generate a prediction that you like, click the "Add to example gallery" button to display that output on your model page.

Share your model

Congratulations! You've now got a hosted machine learning model with a web-based demo that anyone can use! Now it's time to share it with the your friends, peers, and colleagues. Share a link to the model page, or use the "Share a link to this output" button to share the output of a specific prediction from your model.


Did something go wrong along the way? Let us know and we'll help. If you encountered a problem with Cog, you can file a GitHub issue. Otherwise chat with us in Discord or send us an email at team@replicate.com.

Replicate Reproducible machine learning