Fix bug: pprint -> pformat

This commit is contained in:
Yin Li 2020-02-11 12:55:08 -05:00
parent 2e2adc761d
commit cc0efd28ec
2 changed files with 2 additions and 3 deletions

View File

@ -1,9 +1,9 @@
import warnings import warnings
from pprint import pprint from pprint import pformat
def load_model_state_dict(model, state_dict, strict=True): def load_model_state_dict(model, state_dict, strict=True):
bad_keys = model.load_state_dict(state_dict, strict) bad_keys = model.load_state_dict(state_dict, strict)
if bad_keys.missing_keys or bad_keys.unexpected_keys: if bad_keys.missing_keys or bad_keys.unexpected_keys:
warnings.warn(pprint(repr(bad_keys))) warnings.warn(pformat(bad_keys))

View File

@ -47,7 +47,6 @@ def node_worker(args):
node = int(os.environ['SLURM_NODEID']) node = int(os.environ['SLURM_NODEID'])
if node == 0: if node == 0:
pprint(vars(args)) pprint(vars(args))
args.node = node
spawn(gpu_worker, args=(node, args), nprocs=args.gpus_per_node) spawn(gpu_worker, args=(node, args), nprocs=args.gpus_per_node)