KevinMusgrave/pytorch-metric-learning
Train and evaluate embeddings for similarity search with PyTorch. Includes contrastive losses, hard example mining, samplers, and retrieval metrics.
What it solves
Building embedding models for tasks like retrieval, clustering, and recognition requires complex setups involving pair and triplet data. This library simplifies that process by providing ready-to-use building blocks for training embedding models.
How it works
It offers composable PyTorch components—such as losses, hard-example miners, distances, reducers, and regularizers—that you can plug directly into your own training loops. Your model outputs embeddings, and the library's components handle operations like pulling positive pairs together and pushing negatives apart.
Who it’s for
It is designed for machine learning developers and researchers working with PyTorch who need to train embedding models for similarity learning, image or data retrieval, clustering, and classification.
Highlights
- Composable losses, miners, distances, reducers, and regularizers
- Compatible with standard PyTorch training loops
- Optional integrations with Faiss for retrieval and scikit-learn for clustering metrics
- Core package relies only on PyTorch and NumPy
Related
- Project
Lightning-AI/torchmetricsTorchMetrics is a collection of over 100 PyTorch metric implementations that reduces boilerplate and handles automatic batch accumulation and multi-device synchronization for scalable machine learning applications.
- Project
marcellodebernardi/loss-landscapesA PyTorch library that helps researchers visualize neural network loss landscapes by approximating high-dimensional parameter spaces in 1D or 2D.
- Project
ankane/torch.rbTorch.rb is a Ruby gem that brings PyTorch-style deep learning to Ruby, powered by LibTorch (PyTorch's C++ engine). It provides tensors, operations, automatic differentiation (autograd), neural network modules, optimizers, and model save/load — all following the PyTorch API with Ruby naming conventions. Installation requires downloading LibTorch first and takes 5–10 minutes to compile; Windows is unsupported. GPU acceleration works via CUDA on Linux and MPS on Apple silicon. The project includes companion libraries for vision, text, audio, and more, plus tutorials and examples for getting started.
- Project
toshas/torch-fidelitytorch-fidelity is a PyTorch library that provides precise, fast, and extensible implementations of popular generative model evaluation metrics (ISC, FID, KID, PRC, PPL, MIND). It matches reference implementations to machine precision while using feature sharing and caching to make computation efficient enough for use in training loops.
- Project
pyg-team/pytorch_geometricPyTorch Geometric (PyG) is a PyTorch‑based library for building, training, and scaling graph neural networks. It offers a unified API, dozens of ready‑made GNN layers, data loaders for large and heterogeneous graphs, and easy extensibility via a `MessagePassing` base class.