MCPcopy Create free account
hub / github.com/apple/axlearn / from_flags

Method from_flags

axlearn/cloud/common/utils.py:631–643  ·  view source on GitHub ↗

Populate config partially using parsed absl flags. This method should only set configs that are used by this class, and not any child classes, which allows each class to be encapsulated. To read flags recursively, use `utils.from_flags`.

(cls, fv: flags.FlagValues, **kwargs)

Source from the content-addressed store, hash-verified

629
630 @classmethod
631 def from_flags(cls, fv: flags.FlagValues, **kwargs) -> Config:
632 """Populate config partially using parsed absl flags.
633
634 This method should only set configs that are used by this class, and not any child classes,
635 which allows each class to be encapsulated.
636
637 To read flags recursively, use `utils.from_flags`.
638 """
639 cfg: FlagConfigurable.Config = kwargs.pop("prebuilt_cfg", cls.default_config())
640 flag_values = {**fv.flag_values_dict(), **kwargs}
641 return cfg.set(
642 **{field: flag_values[field] for field in cfg.keys() if field in flag_values}
643 )
644
645 @classmethod
646 def set_defaults(cls, fv: flags.FlagValues):

Callers 3

enter_from_flagsFunction · 0.45
test_from_flagsMethod · 0.45
test_executeMethod · 0.45

Calls 3

keysMethod · 0.80
default_configMethod · 0.45
setMethod · 0.45

Tested by 2

test_from_flagsMethod · 0.36
test_executeMethod · 0.36