vp_suite.utils.compatibility

check_model_and_data_compat(model, dataset, strict_mode=False)

Checks consistency of given model and given dataset. If in strict mode, discrepancies in tensor value range and img size will be bridged with adapters. Otherwise, discrepancies are not allowed and will lead to errors.

Parameters
  • model (VPModel) – The model to check against the dataset.

  • (Union[VPDataset (dataset) – The dataset to check against the model.

  • VPDatasetWrapper] – The dataset to check against the model.

  • strict_mode (bool) – If set to true, any config discrepancy will lead to an error thrown. Otherwise, the method tries to bridge smaller discrepancies by creating adapter modules.

Returns

PyTorch adapter modules for pre- and postprocessing that bridge minor config discrepancies. If no discrepancies were found, these modules are identity layers.

check_run_and_model_compat(model, run_config)

Checks consistency of the config of a loaded model with given the run configuration. If any critical inconsistency is found, this method raises an error.

Parameters
  • model (VPModel) – The model to be checked against the run configuration.

  • run_config (dict) – The run configuration to be checked against the model.