fresco package

Subpackages

Submodules

fresco.data_setup module

fresco.run_clc module

Top-level clc model building script using independent modules.

fresco.run_clc.create_doc_embeddings(model, model_type, data_loader, device)[source]

Generate document embeddings from trained model.

fresco.run_clc.create_model(params, dw, device)[source]

Define a model based on model_args.

Parameters:
  • params (dict) – Dictionary of model_args file.

  • dw (DataHandler) – DataHandler class object.

  • device (torch.device) – Torch device, either ‘cpu’ or ‘cuda’.

Returns:

A model.

fresco.run_clc.load_model(model_dict, device, dw)[source]
fresco.run_clc.load_model_dict(model_path, data_path='')[source]

Load pretrained model from disk.

Parameters:
  • model_path (str) – Path to the saved model from command line args.

  • valid_params (ValidateParams) – ValidateParams class object with model_args dict.

  • data_path (str or None) – Path to data from the trained model, or None.

We check if the supplied path is valid and if the packages match needed to run the pretrained model.

fresco.run_clc.main()[source]
fresco.run_clc.run_case_level(args)[source]
fresco.run_clc.save_full_model(kw_args, save_path, packages, fold)[source]

Save trained model with package info metadata.

fresco.run_ie module

Top-level information extraction model building script using independent modules.

fresco.run_ie.create_model(params, dw, device)[source]

Define a model based on model_args.

Parameters:
  • params (dict) – Dictionary of model_args file.

  • dw (DataHandler) – DataHandler class object.

  • device (torch.device) – Torch device, either ‘cpu’ or ‘cuda’.

Returns:

A model.

fresco.run_ie.load_model(model_path, device, dw, valid_params)[source]

Load a pretrained model from disk.

Parameters:
  • model_path (str) – Path to the saved model obtained from command line args.

  • device (torch.device) – Torch device, either ‘cuda’ or ‘cpu’, set in the calling function.

  • dw (DataHandler) – DataHandler class instance for wrangling data and checking metadata.

  • valid_params (ValidateParams) – ValidateParams class instance with model_args dict.

Post-condition:

The saved model is loaded and set to eval() mode.

Returns:

None

fresco.run_ie.main()[source]
fresco.run_ie.run_ie(args=None)[source]
fresco.run_ie.save_full_model(kw_args, save_path, packages, fold)[source]

Save trained model with package info metadata.

Module contents