class_docstr: A variant of dataclass that allows fields without defaults to be unpopulated for
  class instances.
  
  Fields with defaults will always be set as instance attributes.
  Fields without defaults will be set as attributes only if a value is provided in the init.
class_docstr_tok: ["A","variant","of","dataclass","that","allows","fields","without","defaults","to","be","unpopulated","for","class","instances",".","Fields","with","defaults","will","always","be","set","as","instance","attributes",".","Fields","without","defaults","will","be","set","as","attributes","only","if","a","value","is","provided","in","the","init","."]
code: def as_dict(self) -> Dict[str, Any]:
      output = {}
      for f in dataclasses.fields(self):
          if hasattr(self, f.name):
              output[f.name] = getattr(self, f.name)
      return output
  
file_path: determined/model_hub/model_hub/huggingface/_config_parser.py
imports: import dataclasses
  from typing import Any, Dict, Optional, Tuple, Union
  from model_hub import utils
label_desc: Use image node_id 2 for calling the FlexibleDataclass obj's underlying member method code with example usage: obj.as_dict() and returns: output