{"data":{"slug":"nomic-ai-contrastors","name":"contrastors","tagline":"Train Models Contrastively in Pytorch","github_url":"https://github.com/nomic-ai/contrastors","owner":"nomic-ai","repo":"contrastors","owner_avatar_url":"https://avatars.githubusercontent.com/u/102670180?v=4","primary_language":"Python","stars":801,"forks":65,"topics":["contrastive-learning","deep-learning","dense-retrieval","embeddings","image-embeddings","multimodal","multimodal-rag","pytorch","rag","text-embeddings","transformers"],"archived":false,"github_pushed_at":"2025-03-26T18:40:32+00:00","maintenance_label":"Dormant","stars_delta_30d":3,"url":"https://www.graphcanon.com/tools/nomic-ai-contrastors","markdown_url":"https://www.graphcanon.com/tools/nomic-ai-contrastors.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/nomic-ai-contrastors","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=nomic-ai-contrastors","description":"Train Models Contrastively in Pytorch","homepage_url":null,"license":"Apache-2.0","open_issues":16,"watchers":12,"ai_summary":"A Python library for training contrastive learning models using PyTorch.","readme_excerpt":"## Getting Started and Requirements\n\nThe `contrastors` library relies on custom kernels from the [Flash Attention](https://github.com/Dao-AILab/flash-attention) repository. To setup your enviornment you will need to follow the steps below.\n\nMake 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)\"`\n\nCreate a python venv and activate it\n\n```bash\npython3 -m venv env\nsource env/bin/activate\n```\n\nInstall [torch](https://pytorch.org/get-started/locally/). 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).\n\n```bash\npip3 install torch torchvision torchaudio\n```\n\nInstall wheel, packaging, ninja for Flash Attention (so the builds don't take too long)\n\n```bash\npip install wheel packaging ninja setuptools\n```\n\nInstall Flash Attention and the custom kernels\n\n```bash\npip 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\n```\n\nInstall the rest of the requirements and the package\n\n```bash\npip install -e . \n```\n\n---\n\n## License\n\nThis code is licensed under the [Apache 2.0 License](LICENSE). See the model cards for the individual license for each model.","github_created_at":"2024-01-30T15:39:06+00:00","created_at":"2026-07-11T11:32:21.21961+00:00","updated_at":"2026-08-22T18:02:19.59409+00:00","categories":[{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"}],"tags":[{"slug":"contrastive-learning","name":"contrastive-learning"},{"slug":"deep-learning","name":"deep-learning"},{"slug":"dense-retrieval","name":"dense-retrieval"},{"slug":"embeddings","name":"embeddings"},{"slug":"image-embeddings","name":"image-embeddings"},{"slug":"multimodal","name":"multimodal"},{"slug":"multimodal-rag","name":"multimodal-rag"},{"slug":"pytorch","name":"pytorch"}],"trust":{"provenance":{"is_fork":false,"github_id":750409062,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-22T18:02:18.786Z","maintenance":{"label":"Dormant","score":18,"methodology":"github_public_v1","releases_90d":0,"days_since_push":513,"last_release_at":null,"stars_delta_30d":3,"open_issues_delta_30d":0},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T11:32:22.541Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-22T18:02:19.270Z"},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-08-22T18:02:19.270Z"},"license_spdx":{"value":"Apache-2.0","source":"github.license","observed_at":"2026-08-22T18:02:19.270Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["* 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."],"when_not_to_use":["* 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."],"source":"enrich:decision_facts","observed_at":"2026-07-12T18:10:46.580Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"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."}]}}