MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / update_args_with_file

Function update_args_with_file

SwissArmyTransformer/sat/arguments.py:472–487  ·  view source on GitHub ↗
(args, path)

Source from the content-addressed store, hash-verified

470
471
472def update_args_with_file(args, path):
473 with open(path, 'r', encoding='utf-8') as f:
474 config = json.load(f)
475 # expand relative path
476 folder = os.path.dirname(path)
477 for k in config:
478 # all the relative paths in config are based on the folder
479 if k.endswith('_path'):
480 config[k] = os.path.join(folder, config[k])
481 print_rank0(f'> parsing relative path {k} in model_config as {config[k]}.')
482 args = vars(args)
483 for k in list(args.keys()):
484 if k in config:
485 del args[k]
486 args = argparse.Namespace(**config, **args)
487 return args
488
489
490def overwrite_args_by_dict(args, overwrite_args={}):

Callers 5

from_pretrained_baseMethod · 0.90
from_pretrained_baseMethod · 0.90
from_pretrainedMethod · 0.90
from_pretrainedMethod · 0.90

Calls 2

print_rank0Function · 0.90
loadMethod · 0.45

Tested by

no test coverage detected