📟 CLI#

text_machina.cli.explore(config_path, task_type, metrics_path=None, run_name=None, save_dir=None, max_generations=10, interactive=True)[source]#

Generates a small set of texts, compares it against human texts, providing metrics and an interface for manual inspection of the generations

Return type:

None

text_machina.cli.generate(config_path, task_type, run_name=None, save_dir=None)[source]#

Generates a dataset from the provided config or directory with configs.

Return type:

None

text_machina.cli_utils.compute_statistics(dataset)[source]#

Computes a set of statistics of a generated dataset.

Parameters:

dataset (Dataset) – the dataset of which statistics are computed.

Returns:

the statistics.

Return type:

Dict[str, pd.DataFrame]

text_machina.cli_utils.count_errors(dataset)[source]#

Counts the number of generation errors in the dataset. A generation error is identified as a text being GENERATION_ERROR.

Parameters:

dataset (Dataset) – a dataset.

Returns:

number of errors in the dataset.

Return type:

int

text_machina.cli_utils.generate_dataset(configs, save_dir, run_name)[source]#

Generates a dataset given a list of configs. Only generates a dataset for a config if it hasn’t been already generated for this run_name.

Computes statistics for the generated dataset.

Parameters:
  • configs (List[Config]) – list of configs to use for generation.

  • save_dir (Path) – root dir where to save the generated dataset.

  • run_name (str) – name of this run.

Returns:

a tuple (dataset, statistics dict)

Return type:

Tuple[Dataset, Dict[str, pd.DataFrame]]

text_machina.cli_utils.generate_from_config(config, save_dir, run_name)[source]#

Generates a dataset using TextGeneration parameterized by config and saves it.

Parameters:
  • config (Config) – a configuration.

  • save_dir (Path) – root dir where to save the generated dataset.

  • run_name (str) – name of this run.

Returns:

path where the generated dataset was saved.

Return type:

Path

text_machina.cli_utils.generate_run_name()[source]#

Generates a name for a run.

Returns:

name of the run.

Return type:

str

text_machina.cli_utils.log_final_message(run_name)[source]#

Logs the last logging message of TextMachina.

Parameters:

run_name (str) – name of the run.

Return type:

None