From 3c2af215b7a391c762e1fbd62cffad829c23d64d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 16 Jun 2026 19:18:44 +0000 Subject: [PATCH 1/3] Update README and docs for in-repo examples --- README.md | 2 +- docs/deploy.md | 2 +- docs/examples.md | 41 +++++++++++++++++++++++++++++++++++++++++ docs/getting-started.md | 2 ++ examples/README.md | 26 ++++++++++++++++++++++++++ mkdocs.yml | 1 + 6 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 docs/examples.md create mode 100644 examples/README.md diff --git a/README.md b/README.md index 7766bdc9bd..e8af803911 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to set up a development environme - [Get started with your own model](docs/getting-started-own-model.md) - [Using Cog with notebooks](docs/notebooks.md) - [Using Cog with Windows 11](docs/wsl2/wsl2.md) -- [Take a look at some examples of using Cog](https://github.com/replicate/cog-examples) +- [Browse the example models in this repo](examples/README.md) - [Deploy models with Cog](docs/deploy.md) - [`cog.yaml` reference](docs/yaml.md) to learn how to define your model's environment - [Run interface reference](docs/python.md) to learn how the `Runner` interface works diff --git a/docs/deploy.md b/docs/deploy.md index 6abaaa12d5..a0c901ab8e 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -9,7 +9,7 @@ that handles HTTP requests, worker process management, and run execution. This guide assumes you have a model packaged with Cog. If you don't, [follow our getting started guide](getting-started-own-model.md), -or use [an example model](https://github.com/replicate/cog-examples). +or start from one of the [examples in the Cog repository](examples.md). ## Getting started diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000000..973c09093b --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,41 @@ +# Examples + +Cog's example models now live in the main Cog repository under +[`examples/`](https://github.com/replicate/cog/tree/main/examples). + +If you want a working project to copy from, start with one of these: + +- [`hello-world`](https://github.com/replicate/cog/tree/main/examples/hello-world): + minimal string input/output example +- [`hello-image`](https://github.com/replicate/cog/tree/main/examples/hello-image): + returns a static image +- [`hello-context`](https://github.com/replicate/cog/tree/main/examples/hello-context): + shows how to read prediction context +- [`hello-concurrency`](https://github.com/replicate/cog/tree/main/examples/hello-concurrency): + demonstrates the `concurrency` setting in `cog.yaml` +- [`hello-train`](https://github.com/replicate/cog/tree/main/examples/hello-train): + defines a training interface +- [`hello-replicate`](https://github.com/replicate/cog/tree/main/examples/hello-replicate): + uses `cog.Secret` inputs and calls the Replicate API +- [`blur`](https://github.com/replicate/cog/tree/main/examples/blur): + simple image-to-image transformation +- [`resnet`](https://github.com/replicate/cog/tree/main/examples/resnet): + GPU image classification with ResNet50 +- [`streaming-text`](https://github.com/replicate/cog/tree/main/examples/streaming-text): + streaming text generation with server-sent events +- [`z-image-turbo`](https://github.com/replicate/cog/tree/main/examples/z-image-turbo): + a generative image model example +- [`notebook`](https://github.com/replicate/cog/tree/main/examples/notebook): + runs a Jupyter notebook with Cog +- [`canary`](https://github.com/replicate/cog/tree/main/examples/canary): + small streaming output example used for validation +- [`managed-weights`](https://github.com/replicate/cog/tree/main/examples/managed-weights): + managed weights pipeline fixture + +There is also an experimental example: + +- [`experimental/resnet-managed-weights`](https://github.com/replicate/cog/tree/main/examples/experimental/resnet-managed-weights): + ResNet50 packaged with managed weights + +For a quick summary of every example in the tree, see +[`examples/README.md`](https://github.com/replicate/cog/blob/main/examples/README.md). diff --git a/docs/getting-started.md b/docs/getting-started.md index db9477da10..bd3b754caf 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,6 +1,8 @@ # Getting started This guide will walk you through what you can do with Cog by using an example model. +If you'd rather start from a complete example, browse the +[examples in the Cog repository](examples.md). > [!TIP] > Using a language model to help you write the code for your new Cog model? diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000000..ac3f5939dd --- /dev/null +++ b/examples/README.md @@ -0,0 +1,26 @@ +# Examples + +Cog's example models now live in this repository under `examples/`. + +## Examples + +- [`blur`](blur): image-to-image box blur example +- [`canary`](canary): simple streaming string output example +- [`hello-concurrency`](hello-concurrency): demonstrates the `concurrency` + setting in `cog.yaml` +- [`hello-context`](hello-context): shows how to read prediction context +- [`hello-image`](hello-image): returns a static image +- [`hello-replicate`](hello-replicate): uses `cog.Secret` inputs and calls the + Replicate API +- [`hello-train`](hello-train): defines a training interface +- [`hello-world`](hello-world): minimal string input/output example +- [`managed-weights`](managed-weights): managed weights pipeline fixture +- [`notebook`](notebook): runs a Jupyter notebook with Cog +- [`resnet`](resnet): GPU image classification with ResNet50 +- [`streaming-text`](streaming-text): streaming text generation example +- [`z-image-turbo`](z-image-turbo): generative image model example + +## Experimental examples + +- [`experimental/resnet-managed-weights`](experimental/resnet-managed-weights): + ResNet50 packaged with managed weights diff --git a/mkdocs.yml b/mkdocs.yml index 4568a903fe..cf14dec9a9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,6 +4,7 @@ docs_dir: docs/ nav: - README: README.md - Getting Started: getting-started.md + - Examples: examples.md - Using your own model: getting-started-own-model.md - Deploy your model: deploy.md - YAML spec: yaml.md From e505dd65986c8df4513c7ab7b96061a58ca9d42a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 16 Jun 2026 19:19:32 +0000 Subject: [PATCH 2/3] Fix docs link for examples page --- README.md | 2 +- docs/llms.txt | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e8af803911..85ef45b6d9 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to set up a development environme - [Get started with your own model](docs/getting-started-own-model.md) - [Using Cog with notebooks](docs/notebooks.md) - [Using Cog with Windows 11](docs/wsl2/wsl2.md) -- [Browse the example models in this repo](examples/README.md) +- [Browse the example models in this repo](docs/examples.md) - [Deploy models with Cog](docs/deploy.md) - [`cog.yaml` reference](docs/yaml.md) to learn how to define your model's environment - [Run interface reference](docs/python.md) to learn how the `Runner` interface works diff --git a/docs/llms.txt b/docs/llms.txt index 2044b2f6d7..848a072412 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -177,7 +177,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to set up a development environme - [Get started with your own model](docs/getting-started-own-model.md) - [Using Cog with notebooks](docs/notebooks.md) - [Using Cog with Windows 11](docs/wsl2/wsl2.md) -- [Take a look at some examples of using Cog](https://github.com/replicate/cog-examples) +- [Browse the example models in this repo](examples/README.md) - [Deploy models with Cog](docs/deploy.md) - [`cog.yaml` reference](docs/yaml.md) to learn how to define your model's environment - [Run interface reference](docs/python.md) to learn how the `Runner` interface works @@ -516,7 +516,7 @@ that handles HTTP requests, worker process management, and run execution. This guide assumes you have a model packaged with Cog. If you don't, [follow our getting started guide](getting-started-own-model.md), -or use [an example model](https://github.com/replicate/cog-examples). +or start from one of the [examples in the Cog repository](examples.md). ## Getting started @@ -887,6 +887,51 @@ $ COG_PUSH_MULTIPART_THRESHOLD=268435456 cog push ``` +--- + +# Examples + +Cog's example models now live in the main Cog repository under +[`examples/`](https://github.com/replicate/cog/tree/main/examples). + +If you want a working project to copy from, start with one of these: + +- [`hello-world`](https://github.com/replicate/cog/tree/main/examples/hello-world): + minimal string input/output example +- [`hello-image`](https://github.com/replicate/cog/tree/main/examples/hello-image): + returns a static image +- [`hello-context`](https://github.com/replicate/cog/tree/main/examples/hello-context): + shows how to read prediction context +- [`hello-concurrency`](https://github.com/replicate/cog/tree/main/examples/hello-concurrency): + demonstrates the `concurrency` setting in `cog.yaml` +- [`hello-train`](https://github.com/replicate/cog/tree/main/examples/hello-train): + defines a training interface +- [`hello-replicate`](https://github.com/replicate/cog/tree/main/examples/hello-replicate): + uses `cog.Secret` inputs and calls the Replicate API +- [`blur`](https://github.com/replicate/cog/tree/main/examples/blur): + simple image-to-image transformation +- [`resnet`](https://github.com/replicate/cog/tree/main/examples/resnet): + GPU image classification with ResNet50 +- [`streaming-text`](https://github.com/replicate/cog/tree/main/examples/streaming-text): + streaming text generation with server-sent events +- [`z-image-turbo`](https://github.com/replicate/cog/tree/main/examples/z-image-turbo): + a generative image model example +- [`notebook`](https://github.com/replicate/cog/tree/main/examples/notebook): + runs a Jupyter notebook with Cog +- [`canary`](https://github.com/replicate/cog/tree/main/examples/canary): + small streaming output example used for validation +- [`managed-weights`](https://github.com/replicate/cog/tree/main/examples/managed-weights): + managed weights pipeline fixture + +There is also an experimental example: + +- [`experimental/resnet-managed-weights`](https://github.com/replicate/cog/tree/main/examples/experimental/resnet-managed-weights): + ResNet50 packaged with managed weights + +For a quick summary of every example in the tree, see +[`examples/README.md`](https://github.com/replicate/cog/blob/main/examples/README.md). + + --- # Getting started with your own model @@ -1069,6 +1114,8 @@ Next, you might want to take a look at: # Getting started This guide will walk you through what you can do with Cog by using an example model. +If you'd rather start from a complete example, browse the +[examples in the Cog repository](examples.md). > [!TIP] > Using a language model to help you write the code for your new Cog model? From c8fa9ff7dd9d9d05851c106450023bd996ce03b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 16 Jun 2026 19:20:05 +0000 Subject: [PATCH 3/3] Regenerate llms docs for examples updates --- docs/llms.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/llms.txt b/docs/llms.txt index 848a072412..766c465858 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -177,7 +177,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to set up a development environme - [Get started with your own model](docs/getting-started-own-model.md) - [Using Cog with notebooks](docs/notebooks.md) - [Using Cog with Windows 11](docs/wsl2/wsl2.md) -- [Browse the example models in this repo](examples/README.md) +- [Browse the example models in this repo](docs/examples.md) - [Deploy models with Cog](docs/deploy.md) - [`cog.yaml` reference](docs/yaml.md) to learn how to define your model's environment - [Run interface reference](docs/python.md) to learn how the `Runner` interface works