v0.9.97
Bug fixes
- Small fix for NTXentLoss with no negative pairs #272
- Fixed .detach() bug in NTXentLoss #282
- Fixed parameter override bug in MatchFinder.get_matching_pairs() #286 by @joaqo
New features and improvements
AccuracyCalculator now uses torch instead of numpy
- All the calculations (except for NMI and AMI) are done with torch. Calculations will be done on the same device and dtype as the input query tensor.
- You can still pass numpy arrays into
AccuracyCalculator.get_accuracy
, but the arrays will be immediately converted to torch tensors.
Faster custom label comparisons in AccuracyCalculator
- See #264 by @mlopezantequera
Numerical stability improvement for DistanceWeightedMiner
UniformHistogramMiner
This is like DistanceWeightedMiner, except that it works well with high dimension embeddings, and works with any distance metric (not just L2 normalized distance). Documentation
PerAnchorReducer
This converts unreduced pairs to unreduced elements. For example, NTXentLoss returns losses per positive pair. If you used PerAnchorReducer with NTXentLoss, then the losses per pair would first be converted to losses per batch element, before being passed to the inner reducer. See the documentation
BaseTester no longer converts embeddings from torch to numpy
This includes the get_all_embeddings
function. If you want get_all_embeddings
to return numpy arrays, you can set the return_as_numpy
flag to True:
embeddings, labels = tester.get_all_embeddings(dataset, model, return_as_numpy=True)
The embeddings are converted to numpy only for the visualizer
and visualizer_hook
, if specified.
Reduced usage of .to(device) and .type(dtype)
Tensors are initialized on device and with the necessary dtype, and they are moved to device and cast to dtypes only when necessary. See this code snippet for details.
Simplified DivisorReducer
Replaced "divisor_summands" with "divisor".