help="yaml file containing the configuration.") parser.add_argument("--cudaid", type=str, default="0", help="cuda id.") input_args, _ = parser.parse_known_args() args, args_dict = get_yaml_args(input_args) # =============== # Reproducibility # =============== # ================================================== # Device, criteria, folders, output logs, callbacks. # ================================================== DEVICE = get_device(args) CPUDEVICE = get_cpu_device() CRIT_TR = instantiate_train_loss(args).to(DEVICE) CRIT_EV = instantiate_eval_loss(args).to(DEVICE) FOLDER = '.' OUTD = join( FOLDER, "exps", # "nbr_erase-{}-".format(args.nbr_times_erase), "PID-{}-{}-bsz-{}-kmax-kmin-{}-dout-{}-erase-nbr-{}-at-epoch-{}-max-epochs-{}-stepsize-" "{}-nbr-modalitities-{}-lr-{}-mx-epochs-{}".format( os.getpid(), get_exp_name(args), args.batch_size, args.model["kmax"], args.model["dropout"], args.nbr_times_erase,
def test_get_device(self): self.assertEqual(tools.get_device('/proc'), 'proc') self.assertRegex(tools.get_device('/sys'), r'sys.*') self.assertRegex(tools.get_device('/nonExistingFolder/foo/bar'), r'/dev/.*')