Repository navigation
v3.0.0rc2
Pre-release3.0.0rc2
This is the second release candidate for version 3.0.0. It adds contributed
losses and corrects two numerical issues. The
3.0.0rc1 notes describe version 3 as a whole, and the
migration guide covers version 2 names.
New features
- MultiSupConLoss adds supervised contrastive
learning for boolean label sets, with Jaccard-weighted positives and an
inclusivethreshold. Adapted from a contribution by Qibin Liang
(#667):
the separateCrossBatchMemory4MultiLabelclass is replaced by
CrossBatchMemorywith
label_shapeandpair_function, and pair tuples stay standard instead of
carrying a similarity matrix. The threshold is inclusive as in the paper, and
two empty label sets have similarity 1. - DynamicArcFaceLoss adds class-size margins
for long-tailed data. Adapted from a contribution by chingis
(#452):
it derives fromSubCenterArcFaceLossinstead of wrapping a loss and changing
its margin on each forward, and takes the paper's margin bounds instead of
aandb. FaissKNNpasses CUDA tensors directly to a GPU index on the same device.
Sharded multi-GPU indices and tensors on another GPU keep CPU copies. Extracted
from a contribution by Domenico Muscillo
(#643).
Numerical corrections
NTXentLosssubtracts each anchor's maximum negative score before temperature
scaling and uses softplus, which preserves small losses under large common
score offsets. Contributed by Afloat
(#758).TupletMarginLossuses exact endpoint angles with a zero angular gradient at
nonzero margin, uses the cosine directly at zero margin, and clamps only values
outside[-1, 1]. Adapted from a contribution by AryanRG
(#765).
Regression coverage
-
DistanceWeightedMinertests now cover 65,536 eligible negatives,
high-dimensional anchors, nearly antipodal negatives above
nonzero_loss_cutoff, and the strict cutoff boundary. Adapted from
contributions by kocean9-freedom
(#764). -
PNPLosstests now check all five variants against independent scalar values
and analytic embedding gradients, half-precision exponent overflow, masked
comparisons, and float32 negative tails with zero absolute tolerance. Adapted
from a contribution by Afloat
(#759). -
HistogramLosstests now check endpoint probability mass, interior
interpolation values and slopes, and collapsed and opposite embeddings in each
dtype. Adapted from a contribution by Afloat
(#756).
Extension changes
modify_cosine_of_target_classesin subclasses ofArcFaceLoss,CosFaceLoss,
andLargeMarginSoftmaxLossnow receiveslabelsas a second argument.- A
BaseMetricLossFunctionsubclass can set the class attributelabel_ndim
to 2 to accept(batch, classes)labels.