ducho.config package

Submodules

ducho.config.Config module

class ducho.config.Config.Config(config_file_path, argv)[source]

Bases: object

Manage the configuration within the config YAML file.

These configurations are needed to define what extracions to perform.

get_columns(modality)[source]

Gives the column names in the case of textual and visual_textual modalities :param modality: ‘textual’, ‘visual’, ‘audio’, or ‘visual_textual’

Returns:

two dicts as { ‘item_column’: column name for items’ ids, ‘text_column’: column name for items’ descriptions } for interactions: two dicts as { ‘interaction_columns’: column name for items’ ids, ‘text_column’: column name for items’ descriptions }

Return type:

for items

get_extractions()[source]

Get the extraction configurations.

Returns:

A dictionary containing extraction configurations for visual, textual, and visual_textual data.

Return type:

dict

get_gpu()[source]

Get the GPU list as a string.

Returns:

The GPU list as a string.

Return type:

str

get_models_list(origin_of_elaboration, type_of_extraction)[source]

Get the list of models.

Parameters:
  • origin_of_elaboration (str) – Either ‘items’ or ‘interactions’.

  • type_of_extraction (str) – Either ‘textual’, ‘visual’, or ‘audio’.

Returns:

A list of model dictionaries, where each model contains the following keys:
  • ’name’: The name of the model.

  • ’output_layers’: The layers of extraction.

  • ’framework’: The framework to work with (e.g., ‘tensorflow’, ‘torch’, ‘transformers’).

  • ’preprocessing_flag’: A custom flag to manage the preprocessing of the data.

Return type:

list

has_config(origin_of_elaboration, type_of_extraction)[source]

Check if the configuration contains values for the specified origin of elaboration and type of extraction.

Parameters:
  • origin_of_elaboration (str) – Either ‘items’ or ‘interactions’.

  • type_of_extraction (str) – Either ‘textual’, ‘visual’, or ‘audio’.

Returns:

True if the configuration contains values, False otherwise.

Return type:

bool

paths_for_extraction(origin_of_elaboration, type_of_extraction)[source]

Get the working environments for extraction.

Parameters:
  • origin_of_elaboration (str) – Either ‘items’ or ‘interactions’.

  • type_of_extraction (str) – Either ‘textual’, ‘visual’, or ‘audio’.

Returns:

A dictionary containing input and output paths.

Return type:

dict

paths_for_multiple_extraction(origin_of_elaboration, type_of_extraction)[source]

Get the working environments for multiple extraction.

Parameters:
  • origin_of_elaboration (str) – Either ‘items’ or ‘interactions’.

  • type_of_extraction (str) – Either ‘textual’, ‘visual’, or ‘audio’.

Returns:

A dictionary containing input and output paths for multiple extractions.

Return type:

dict

Module contents