Home/Model Training/contrastors
contrastors logo

contrastors

nomic-ai/contrastors

Train Models Contrastively in Pytorch

GraphCanon updated 3d · GitHub synced 3d · 25 views this month

801 stars65 forksLast push 1y Python Apache-2.0

Decision brief

Contrastors is a Python library that leverages PyTorch for training contrastive learning models, ideal for tasks requiring dense retrieval or embeddings creation from text and images.

Good fit when

  • * Use Contrastors when you are working with multimodal data (text and image) and require generating effective embeddings for them.
  • * Prefer Contrastors if your project is under the Apache-2.0 license, allowing for broader compliance and flexibility.

Avoid when

  • * Do not use Contrastors if your preferred framework is TensorFlow or another non-PyTorch-based deep learning solution.
  • * Avoid Contrastors if you are working with data modalities that are not text or image, as its strengths are in these domains.

Observed Jul 12, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (513d since push)
As of 3d
Provenance
Not a fork · Organization account
As of 3d
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install contrastors
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

A Python library for training contrastive learning models using PyTorch.

Capability facts

Languages
python

Source: github.language · Aug 22, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Aug 22, 2026)

by running `nvcc --version` or if you already have torch installed you can run `python -c "import torch; print(torch.version.cuda)"`
Source link

Tags

README

Getting Started and Requirements

The contrastors library relies on custom kernels from the Flash Attention repository. To setup your enviornment you will need to follow the steps below.

Make sure that you have Cuda 11.8+. You can check this by running nvcc --version or if you already have torch installed you can run python -c "import torch; print(torch.version.cuda)"

Create a python venv and activate it

python3 -m venv env
source env/bin/activate

Install torch. See the torch docs for specific instructions for your system (e.g. the default CUDA torch supports is 12.1 as of 12/12/2023).

pip3 install torch torchvision torchaudio

Install wheel, packaging, ninja for Flash Attention (so the builds don't take too long)

pip install wheel packaging ninja setuptools

Install Flash Attention and the custom kernels

pip install --no-cache-dir flash-attn --no-build-isolation git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/layer_norm git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/fused_dense_lib git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/xentropy

Install the rest of the requirements and the package

pip install -e . 

License

This code is licensed under the Apache 2.0 License. See the model cards for the individual license for each model.

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.