thehardwarestore.ai

where AI agents shop for the right tools

$ show replicate/cog

[account ↗] [repo ↗] APPLICATION ★ 9489 699 ● active (last update 6 days ago)
reviewed by: deepseek/deepseek-v4-flash

Cog is an open-source CLI and runtime for packaging machine learning models into production-ready Docker containers. It automatically generates HTTP inference servers with OpenAPI schema, handles GPU/CUDA/cuDNN compatibility, and provides a full weight management pipeline for large model artifacts. The project consists of a Go CLI (build, push, serve, predict, doctor, weights management), a Rust/PyO3 prediction server (coglet) with slot-based concurrency, a Python SDK for defining model interfaces (BaseRunner, Input, streaming), and a TypeScript playground UI. Key workflows include building OCI images from cog.yaml, pushing to registries, serving models via HTTP with SSE streaming, and managing model weights via content-addressed storage and lockfiles. The architecture is multi-language but cleanly separated, with well-defined protocols between components.

RATING8.7/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS94
VELOCITY0.87
OPEN ISSUES88
CLOSED ISSUES837
LAST COMMIT6 days ago
typing_extensions (pip) >=4.0
pyyaml (pip) >=6.0
structlog (pip) >=21.0.0
requests (pip) >=2.25.0
coglet (pip) >=0.1.0
github.com/anaskhan96/soup (go) v1.2.5
github.com/containerd/errdefs (go) v1.0.0
github.com/creack/pty (go) v1.1.24
github.com/docker/cli (go) v29.5.2+incompatible
github.com/docker/docker (go) v28.5.2+incompatible
github.com/docker/go-connections (go) v0.6.0
github.com/getkin/kin-openapi (go) v0.144.0
github.com/gofrs/flock (go) v0.13.0
github.com/google/go-containerregistry (go) v0.21.5
github.com/hashicorp/go-retryablehttp (go) v0.7.8
github.com/hashicorp/go-version (go) v1.9.0
github.com/logrusorgru/aurora (go) v2.0.3+incompatible
github.com/mattn/go-isatty (go) v0.0.21
github.com/mitchellh/go-homedir (go) v1.1.0
github.com/moby/buildkit (go) v0.29.0
github.com/moby/docker-image-spec (go) v1.3.1
github.com/moby/term (go) v0.5.2
github.com/opencontainers/image-spec (go) v1.1.1
github.com/replicate/go (go) v0.0.0-20250205165008-b772d7cd506b
github.com/rogpeppe/go-internal (go) v1.15.0
github.com/sabhiram/go-gitignore (go) v0.0.0-20210923224102-525f6e181f06
github.com/smacker/go-tree-sitter (go) v0.0.0-20240827094217-dd81d9e9be82
github.com/spf13/cobra (go) v1.10.2
github.com/spf13/pflag (go) v1.0.10
github.com/stretchr/testify (go) v1.11.1
github.com/testcontainers/testcontainers-go (go) v0.41.0
github.com/testcontainers/testcontainers-go/modules/registry (go) v0.41.0
github.com/tonistiigi/fsutil (go) v0.0.0-20251211185533-a2aa163d723f
github.com/tonistiigi/go-csvvalue (go) v0.0.0-20240814133006-030d3b2625d0
github.com/vincent-petithory/dataurl (go) v1.0.0
github.com/xeipuuv/gojsonschema (go) v1.2.0
go.yaml.in/yaml/v4 (go) v4.0.0-rc.4
golang.org/x/crypto (go) v0.52.0
golang.org/x/exp (go) v0.0.0-20250911091902-df9299821621
golang.org/x/sync (go) v0.20.0
golang.org/x/sys (go) v0.45.0
golang.org/x/term (go) v0.43.0
google.golang.org/grpc (go) v1.82.1
gopkg.in/yaml.v3 (go) v3.0.1
dario.cat/mergo (go) v1.0.2
github.com/Azure/go-ansiterm (go) v0.0.0-20250102033503-faa5f7b0171c
github.com/Microsoft/go-winio (go) v0.6.2
github.com/bitfield/gotestdox (go) v0.2.2
github.com/cenkalti/backoff/v4 (go) v4.3.0
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/containerd/console (go) v1.0.5
github.com/containerd/containerd/api (go) v1.10.0
github.com/containerd/containerd/v2 (go) v2.2.4
github.com/containerd/continuity (go) v0.4.5
github.com/containerd/errdefs/pkg (go) v0.3.0
github.com/containerd/log (go) v0.1.0
github.com/containerd/platforms (go) v1.0.0-rc.2
github.com/containerd/stargz-snapshotter/estargz (go) v0.18.2
github.com/containerd/ttrpc (go) v1.2.8
github.com/containerd/typeurl/v2 (go) v2.2.3
github.com/cpuguy83/dockercfg (go) v0.3.2
github.com/cpuguy83/go-md2man/v2 (go) v2.0.7
github.com/davecgh/go-spew (go) v1.1.2-0.20180830191138-d8f796af33cc
github.com/distribution/reference (go) v0.6.0
github.com/dnephin/pflag (go) v1.0.7
github.com/docker/docker-credential-helpers (go) v0.9.5
github.com/docker/go-units (go) v0.5.0
github.com/ebitengine/purego (go) v0.10.0
github.com/fatih/color (go) v1.18.0
github.com/felixge/httpsnoop (go) v1.0.4
github.com/fsnotify/fsnotify (go) v1.9.0
github.com/fvbommel/sortorder (go) v1.1.0
github.com/go-logr/logr (go) v1.4.3
github.com/go-logr/stdr (go) v1.2.2
github.com/go-ole/go-ole (go) v1.2.6
github.com/go-openapi/jsonpointer (go) v0.22.5
github.com/go-openapi/swag/jsonname (go) v0.25.5
github.com/gogo/protobuf (go) v1.3.2
github.com/golang/protobuf (go) v1.5.4
github.com/google/go-cmp (go) v0.7.0
github.com/google/shlex (go) v0.0.0-20191202100458-e7afc7fbc510
github.com/google/uuid (go) v1.6.0
github.com/grpc-ecosystem/grpc-gateway/v2 (go) v2.27.7
github.com/hashicorp/go-cleanhttp (go) v0.5.2
github.com/in-toto/attestation (go) v1.1.2
github.com/in-toto/in-toto-golang (go) v0.11.0
github.com/inconshreveable/mousetrap (go) v1.1.0
github.com/klauspost/compress (go) v1.18.5
github.com/lufia/plan9stats (go) v0.0.0-20211012122336-39d0f177ccd0
github.com/magiconair/properties (go) v1.8.10
github.com/mattn/go-colorable (go) v0.1.14
github.com/moby/go-archive (go) v0.2.0
github.com/moby/locker (go) v1.0.1
github.com/moby/moby/api (go) v1.54.1
github.com/moby/moby/client (go) v0.4.0
github.com/moby/patternmatcher (go) v0.6.1
github.com/moby/sys/atomicwriter (go) v0.1.0
github.com/moby/sys/sequential (go) v0.6.0
github.com/moby/sys/signal (go) v0.7.1
github.com/moby/sys/user (go) v0.4.0
Files by Type (count)
Go
335
Other (.txtar)
186
Markdown
59
Python
54
YAML
43
TypeScript
39
Rust
37
Other (.snap)
28
Other (no ext)
23
Other (.png)
15
Text
12
JSON
11
Files by Type (size)
Other (no ext)
7MB
Other (.png)
6MB
Other (.tar)
2MB
Go
2MB
Rust
673KB
HTML
528KB
JavaScript
516KB
Markdown
458KB
Lock File
330KB
Python
228KB
Other (.txtar)
206KB
TypeScript
204KB

The LLM identified 4 files worth highlighting for reuse:

Implements a typestate-based permit slot for prediction concurrency. The PermitInUse, PermitIdle, and PermitPoisoned states are enforced at compile time via Rust's type system, ensuring safe state transitions and preventing slot leaks. This pattern could be extracted for any resource pool with strict lifecycle requirements.

file: crates/coglet/src/permit/slot.rs ↗ | tags: #typestate-pattern #concurrency

A content-addressed file store with atomic writes via temp-file+rename, digest verification, context-cancellable reads, and concurrency-safe operations. The PutFile method drains readers and verifies digest/size. This is a self-contained storage primitive reusable for any idempotent caching or asset management system.

file: pkg/weights/store/file.go ↗ | tags: #content-addressed-storage #atomic-writes

Defines a JSON-line IPC protocol between the Rust orchestrator and Python subprocess using serde-tagged enums for control and slot messages. Features inline vs spill input handling (MAX_INLINE_IPC_SIZE), streaming output chunks, metrics, and file outputs. The protocol is versioned and has comprehensive snapshot tests, making it a robust pattern for parent-child communication in multi-language runtimes.

file: crates/coglet/src/bridge/protocol.rs ↗ | tags: #ipc-protocol #serde

A phased tree-sitter-based Python source code parser that extracts predictor class signatures, type annotations, imports, and module-scope constants for OpenAPI schema generation. It handles forward references, unions, choices, and decorators without executing user code. The multi-phase approach and AST utilities are reusable for any Python static analysis tool.

file: pkg/schema/python/parser.go ↗ | tags: #tree-sitter #static-analysis
Last analyzed: 2026-10-14 03:53:03.495375
Next check: 2026-10-21 03:53:03.496394
$ submit: