now.finetuning.generation_fns module#

class now.finetuning.generation_fns.GeneratorFunction[source]#

Bases: abc.ABC

abstract process(document)[source]#

Generation function that produces a DocumentArray given a Document.

Return type

DocumentArray

abstract static name()[source]#

Name for the task config.

Return type

str

class now.finetuning.generation_fns.ImageNormalizer(scope)[source]#

Bases: now.finetuning.generation_fns.GeneratorFunction

Class for image processing and normalization.

Parameters

scope (List[str]) – List of fields to consider for processing.

process(document)[source]#

Processes a Document containing image information.

Parameters

document (Document) – Document containing image data (uris).

Return type

DocumentArray

Returns

DocumentArray of processed images.

static name()[source]#

Name for the task config.

Return type

str

class now.finetuning.generation_fns.TextProcessor(scope, powerset=False, permute=False)[source]#

Bases: now.finetuning.generation_fns.GeneratorFunction

Class for text processing with subsets and permutations.

Parameters
  • scope (List[str]) – List of fields to consider for processing.

  • powerset (bool) – Creates subsets of text fields if set to True.

  • permute (bool) – Creates permutations of fields if set to True.

process(document)[source]#

Processes a Document containing text information.

Parameters
  • document (Document) – Document containing text data.

  • scope – List of fields to consider for processing.

Return type

DocumentArray

Returns

DocumentArray of processed (and concatenated) text data.

static name()[source]#

Name for the task config.

Return type

str