Abhiram V
commited on
Update train.py with yaml.SafeLoader (#1972)
Browse files
train.py
CHANGED
@@ -479,7 +479,7 @@ if __name__ == '__main__':
|
|
479 |
assert os.path.isfile(ckpt), 'ERROR: --resume checkpoint does not exist'
|
480 |
apriori = opt.global_rank, opt.local_rank
|
481 |
with open(Path(ckpt).parent.parent / 'opt.yaml') as f:
|
482 |
-
opt = argparse.Namespace(**yaml.load(f, Loader=yaml.
|
483 |
opt.cfg, opt.weights, opt.resume, opt.batch_size, opt.global_rank, opt.local_rank = '', ckpt, True, opt.total_batch_size, *apriori # reinstate
|
484 |
logger.info('Resuming training from %s' % ckpt)
|
485 |
else:
|
@@ -503,7 +503,7 @@ if __name__ == '__main__':
|
|
503 |
|
504 |
# Hyperparameters
|
505 |
with open(opt.hyp) as f:
|
506 |
-
hyp = yaml.load(f, Loader=yaml.
|
507 |
|
508 |
# Train
|
509 |
logger.info(opt)
|
|
|
479 |
assert os.path.isfile(ckpt), 'ERROR: --resume checkpoint does not exist'
|
480 |
apriori = opt.global_rank, opt.local_rank
|
481 |
with open(Path(ckpt).parent.parent / 'opt.yaml') as f:
|
482 |
+
opt = argparse.Namespace(**yaml.load(f, Loader=yaml.SafeLoader)) # replace
|
483 |
opt.cfg, opt.weights, opt.resume, opt.batch_size, opt.global_rank, opt.local_rank = '', ckpt, True, opt.total_batch_size, *apriori # reinstate
|
484 |
logger.info('Resuming training from %s' % ckpt)
|
485 |
else:
|
|
|
503 |
|
504 |
# Hyperparameters
|
505 |
with open(opt.hyp) as f:
|
506 |
+
hyp = yaml.load(f, Loader=yaml.SafeLoader) # load hyps
|
507 |
|
508 |
# Train
|
509 |
logger.info(opt)
|