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]]
-
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