NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2676 most downloaded on PyPI
The easiest way to use deep metric learning in your application. Modular, flexible, and extensible. Written in PyTorch.
Last release 1 years ago
17 Aug 2025
Release timing varies
gaps range from 3 weeks to 8 months
Most releases are documented
notes for 52 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
212 releases · first in 2019
Nothing published for this version
Nothing published for this version
Added TwoStreamMetricLoss. By @marijnl.
Trainers
BaseTrainer child classes now accept *args and pass it to BaseTrainer, so that you can use positional arguments when you init those child classes, rather than just keyword arguments.Testers
fit_transform method, rather than fit and transform separately.label_hierarchy_levelUtils
best_epoch could be None.average_per_class option, which computes the average accuracy per class, and then returns the average of those averages. This can be useful when evaluating datasets with unbalanced classes.Other stuff
with-hooks and with-hooks-cpu pip install options. The following will install record-keeper, faiss-gpu, and tensorboard, in addition to pytorch-metric-learningpip install pytorch-metric-learning[with-hooks]
If you don't have a GPU you can do:
pip install pytorch-metric-learning[with-hooks-cpu]
One column per quarter.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Removed `size_of_tsne and added visualizer and visualizer_hook to BaseTester. The visualizer needs to implement the fit and transform functions. (In t
Testers
size_of_tsne and added visualizer and visualizer_hook to BaseTester. The visualizer needs to implement the fit and transform functions. (In the next version, I'll allow fit_transform as well.) For example:# UMAP is the dimensionality reducer we will pass in as the visualizer
import umap
import umap.plot
# For plotting the embeddings
def visualizer_hook(umapper, umap_embeddings, labels, split_name, keyname):
logging.info("UMAP plot for the {} split and label set {}".format(split_name, keyname))
umap.plot.points(umapper, labels=labels, show_legend=False)
plt.show()
GlobalEmbeddingSpaceTester(visualizer=umap.UMAP(), visualizer_hook=visualizer_hook)
Utils
include to the init arguments.exclude_metrics to exclude.requires_knn method.check_primary_metrics to AccuracyCalculator, which validates the metrics specified in include and exclude. By @wconnellprimary_metric is in tester.AccuracyCalculator. By @wconnell**kwargs to get_hook_container, so that, for example, you can do get_hook_container(record_keeper, primary_metric="AMI")Other stuff
Nothing published for this version
Nothing published for this version
Nothing published for this version
Added CircleLoss, implemented by @AlenUbuntu
Losses
normalize_embeddings=Falseminer_weights in ProxyAnchorLoss, NCALoss, and FastAPLossUtils
convert_to_weights return values between 0 and 1, where 1 represents the most frequently occuring sample. Before, it was scaling the probability by size of batch.Other stuff
convert_to_weightsNothing published for this version
Nothing published for this version
Made `iterations_per_epoch` optional. See the new documentation
Losses
Trainers
iterations_per_epoch optional. See the new documentationlr_schedulers to allow for end of iteration, end of epoch, and plateau schedulers to all be used at the same time.Utils
HookContainer
skip_eval_if_already_done flag to run_tester_separately.ignore_epoch a tuple.save_custom_figures flag.common_functions
pass_data_to_model and autograd.Variable usage.Other stuff
__version__ was not accessible.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →