MCPcopy
hub / github.com/huggingface/alignment-handbook / parse

Method parse

src/alignment/configs.py:91–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

89 return outputs
90
91 def parse(self) -> DataClassType | Tuple[DataClassType]:
92 if len(sys.argv) == 2 and sys.argv[1].endswith(".yaml"):
93 # If we pass only one argument to the script and it's the path to a YAML file,
94 # let's parse it to get our arguments.
95 output = self.parse_yaml_file(os.path.abspath(sys.argv[1]))
96 # parse command line args and yaml file
97 elif len(sys.argv) > 2 and sys.argv[1].endswith(".yaml"):
98 output = self.parse_yaml_and_args(os.path.abspath(sys.argv[1]), sys.argv[2:])
99 # parse command line args only
100 else:
101 output = self.parse_args_into_dataclasses()
102
103 if len(output) == 1:
104 output = output[0]
105 return output
106
107
108@dataclass

Callers 5

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
get_versionFunction · 0.80

Calls 1

parse_yaml_and_argsMethod · 0.95

Tested by

no test coverage detected