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

Method get_args

SwissArmyTransformer/sat/model/base_model.py:286–302  ·  view source on GitHub ↗

Get the parsed args of the current model. Args: **kwargs: will override the default args. Returns: args: the parsed args.

(cls, **kwargs)

Source from the content-addressed store, hash-verified

284
285 @classmethod
286 def get_args(cls, **kwargs):
287 '''Get the parsed args of the current model.
288 Args:
289 **kwargs: will override the default args.
290 Returns:
291 args: the parsed args.
292 '''
293 parser = cls.list_avail_args(print=False)
294 # use parser to parse kwargs
295 args = parser.parse_args([])
296 for k, v in kwargs.items():
297 if hasattr(args, k) or k in ['fp16']: # non-arch args but affect building models
298 setattr(args, k, v)
299 else:
300 print_rank0(f'warning: Unknown arg {k} for class {cls.__name__}.', level='DEBUG')
301 setattr(args, k, v)
302 return args
303
304class AutoModel():
305 @classmethod

Callers 8

test_speedFunction · 0.80
test_model_get_argsFunction · 0.80
test_mixinFunction · 0.80
__init__Method · 0.80
test_createFunction · 0.80
test_save_and_loadFunction · 0.80
from_pretrained_baseMethod · 0.80
from_pretrained_baseMethod · 0.80

Calls 2

print_rank0Function · 0.90
list_avail_argsMethod · 0.80

Tested by 6

test_speedFunction · 0.64
test_model_get_argsFunction · 0.64
test_mixinFunction · 0.64
__init__Method · 0.64
test_createFunction · 0.64
test_save_and_loadFunction · 0.64