# lucidrains/CoCa-pytorch

Implementation of CoCa, Contrastive Captioners are Image-Text Foundation Models, in Pytorch

Repository: https://github.com/lucidrains/CoCa-pytorch
Canonical: https://ross.abutalabs.com/products/coca-pytorch
Language: Python
License: MIT
License Family: permissive
Topics: artificial-intelligence, attention-mechanism, contrastive-learning, deep-learning, multimodal, transformers, image-to-text
Last push: 2023-12-12T22:44:22+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 1581, "days_push": 995, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1198, forks 89 (observed 2026-08-28T04:03:57.671878+00:00)

## What it is
A Pytorch implementation of CoCa (Contrastive Captioners), an image-text foundation model that combines contrastive learning with an encoder-decoder transformer for image captioning and CLIP-like embeddings. It adopts the PaLM transformer architecture with parallel SwiGLU feedforwards and requires a pretrained vision transformer as the image encoder.

## Use cases
- train a multimodal image-text foundation model in pytorch
- generate captions for images with a transformer model
- get CLIP-style image and text embeddings for contrastive search
- implement contrastive captioning loss for vision-language pretraining
- fine-tune an image-to-text model on my own image-caption dataset
- reproduce CoCa paper results for research

## When to choose
- you want a flexible, hackable Pytorch implementation of the CoCa architecture for research
- you need both captioning and contrastive (CLIP-like) objectives in one model
- you already have a pretrained vision transformer encoder to plug in

## When to avoid
- you need a pretrained, ready-to-use model with weights out of the box
- you want a production inference service rather than a training library
- you prefer frameworks other than Pytorch

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, deep-learning, transformers
- domain: artificial-intelligence, deep-learning, computer-vision
- platform: python
- tags: contrastive-learning, multimodal, image-to-text, image-captioning, clip, research-implementation, vision-transformer, natural-language-processing

## Member repositories
- lucidrains/CoCa-pytorch (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:57.671878+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:21:10.732211+00:00, confidence not recorded.
  - readme: https://github.com/lucidrains/CoCa-pytorch (fetched 2026-08-28T04:03:57.671878+00:00, sha a548aaa1994e)
  - registry_pypi: https://pypi.org/pypi/coca-pytorch/json (fetched 2026-08-29T12:28:39.478216+00:00, sha 9d8aa8d24944)
- Data as of 2026-08-30T08:39:29.467469+00:00.
