vathos.utilsΒΆ

The various utility functions that are essential for vathos

load_config(filename: str) → dict[source]ΒΆ

Load a configuration file as YAML and returns a dict

Parameters:filename (str) – location of the file
Returns:(Dict) of the config
setup_device(model: torch.nn.modules.module.Module, target_device: int) → Tuple[torch.device, List[int]][source]ΒΆ

sets up the device for the model

Parameters:
  • model (nn.Module) – the model
  • target_device (int) – index of the target device
Returns:

Tuple[torch.device, List[int]]

setup_param_groups(model: torch.nn.modules.module.Module, config: Dict) → List[source]ΒΆ
get_instance(module: module, name: str, config: Dict, *args) → Any[source]ΒΆ

creates an instance from a constructor name and module name

Parameters:
  • module (ModuleType) – the module which contains the class
  • name (str) – name of the class
  • config (Dict) – configuration of experiment
  • args (Any) – any arguments that needs to be passed to the class
get_instance_v2(module, ctor_name, *args, **kwargs)[source]ΒΆ

creates an instance from a constructor name and module name

Parameters:
  • module – the module which contains the ctor_name
  • ctor_name – name of the constructor
  • args (Optional) – positional arguments that needs to be passed to ctor
  • kwargs (Optional) – keywords arguments that needs to be passed to ctor
setup_logger(name)[source]ΒΆ