finetuner.tuner.miner.base module

class finetuner.tuner.miner.base.BaseMiner(*args, **kwds)[source]

Bases: abc.ABC, Generic[finetuner.helper.AnyTensor, finetuner.tuner.miner.base.LabelType]

abstract mine(labels, distances)[source]

Generate mined tuples from labels and item distances.

Parameters
  • labels (~LabelType) – labels of each item

  • distances (~AnyTensor) – A tensor matrix of pairwise distance between each two item embeddings

Return type

Tuple[~AnyTensor, …]

Returns

A tuple of 1D tensors, denoting indices or properties of returned tuples

class finetuner.tuner.miner.base.BaseClassMiner(*args, **kwds)[source]

Bases: finetuner.tuner.miner.base.BaseMiner[finetuner.helper.AnyTensor, finetuner.helper.AnyTensor], Generic[finetuner.helper.AnyTensor]

abstract mine(labels, distances)[source]

Generate mined tuples from labels and item distances.

Parameters
  • labels (~AnyTensor) – A 1D tensor of item labels (classes)

  • distances (~AnyTensor) – A tensor matrix of pairwise distance between each two item embeddings

Return type

Tuple[~AnyTensor, …]

Returns

A tuple of 1D tensors, denoting indices or properties of returned tuples

class finetuner.tuner.miner.base.BaseSessionMiner(*args, **kwds)[source]

Bases: finetuner.tuner.miner.base.BaseMiner[finetuner.helper.AnyTensor, Tuple[finetuner.helper.AnyTensor, finetuner.helper.AnyTensor]], Generic[finetuner.helper.AnyTensor]

abstract mine(labels, distances)[source]

Generate mined tuples from labels and item distances.

Parameters
  • labels (Tuple[~AnyTensor, ~AnyTensor]) – A tuple of 1D tensors, denotind the items’ session and match type (0 for anchor, 1 for postive match and -1 for negative match), respectively

  • distances (~AnyTensor) – A tensor matrix of pairwise distance between each two item embeddings

Return type

Tuple[~AnyTensor, …]

Returns

A tuple of 1D tensors, denoting indices or properties of returned tuples