myria3d.utils

myria3d.utils.utils

myria3d.utils.utils.define_device_from_config_param(gpus_param)[source]

Param can be an in specifying a number of GPU to use (0 or 1) or an int in a list specifying which GPU to use (cuda:0, cuda:1, etc.)

myria3d.utils.utils.eval_time(method)[source]

Decorator to log the duration of the decorated method

myria3d.utils.utils.extras(config: omegaconf.dictconfig.DictConfig) None[source]

A couple of optional utilities, controlled by main config file: - disabling warnings - easier access to debug mode - forcing debug friendly configuration

Modifies DictConfig in place.

Parameters

config (DictConfig) – Configuration composed by Hydra.

myria3d.utils.utils.get_logger(name='myria3d.utils.utils') logging.Logger[source]

Initializes multi-GPU-friendly python logger.

myria3d.utils.utils.log_hyperparameters(config: omegaconf.dictconfig.DictConfig, model: pytorch_lightning.core.module.LightningModule, datamodule: pytorch_lightning.core.datamodule.LightningDataModule, trainer: pytorch_lightning.trainer.trainer.Trainer, callbacks: List[pytorch_lightning.callbacks.callback.Callback], logger: List[logging.Logger]) None[source]

This method controls which parameters from Hydra config are saved by Lightning loggers.

Additionaly saves:
  • number of trainable model parameters

myria3d.utils.utils.print_config(config: omegaconf.dictconfig.DictConfig, fields: Sequence[str] = ('task', 'seed', 'logger', 'trainer', 'model', 'datamodule', 'dataset_description', 'callbacks', 'predict'), resolve: bool = True) None[source]

Prints content of DictConfig using Rich library and its tree structure.

Parameters
  • config (DictConfig) – Configuration composed by Hydra.

  • fields (Sequence[str], optional) – Determines which main fields from config will

  • order. (be _sphinx_paramlinks_myria3d.utils.utils.print_config.printed and in what) –

  • resolve (bool, optional) – Whether to resolve reference fields of DictConfig.