#174 · Primary category: Deep Learning Frameworks

contrastors

contrastive-learning deep-learning dense-retrieval embeddings image-embeddings multimodal multimodal-rag pytorch rag text-embeddings transformers

Train Models Contrastively in Pytorch

Project last updated:03/26/25

GitHub Stars

802

Forks

64

Contributors

4

License

Apache-2.0

Why we included this project

This is the training code behind Nomic's embed models, which makes it a useful reference if you are training your own text or image embedding models instead of calling a hosted API. It covers the full pipeline: masked language modeling pretraining, contrastive finetuning, and CLIP-style vision-language alignment, all driven by config files that run across multiple GPUs with DeepSpeed. The Flash Attention integration and GradCache support let teams train with large batch sizes without exhausting GPU memory, and the Matryoshka option trains one model that can serve embeddings at several sizes. Researchers reproducing embedding papers and engineers fine-tuning a retrieval model on their own data will both find the configs and data-loading helpers a solid starting point, even if they end up adapting the code rather than using it as-is.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category