MCPcopy Create free account
hub / github.com/pytorch/executorch / build_args_parser

Function build_args_parser

examples/models/llama/export_llama_lib.py:191–631  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189
190
191def build_args_parser() -> argparse.ArgumentParser:
192 parser = argparse.ArgumentParser()
193 parser.add_argument("-o", "--output-dir", default=".", help="output directory")
194 # parser.add_argument(
195 # "-q", "--quantized_ckpt", default=None, help="quantized checkpoint file"
196 # )
197 parser.add_argument(
198 "--model",
199 default="llama3",
200 choices=EXECUTORCH_DEFINED_MODELS + TORCHTUNE_DEFINED_MODELS,
201 help="The Llama model to export. stories110M, llama2, llama3, llama3_1, and llama3_2 use the same underlying LlamaTransformer architecture defined in ExecuTorch. All other models use TorchTune model definitions.",
202 )
203 parser.add_argument(
204 "-E",
205 "--embedding-quantize",
206 default=None,
207 type=str,
208 help="type of embedding quantization, '<bitwidth>,<groupsize>', e.g., '8,1024'.",
209 )
210 parser.add_argument(
211 "--use_shared_embedding",
212 action="store_true",
213 help="Whether the embedding/unembedding weights should be shared. Only available with torchao kernels.",
214 )
215 parser.add_argument(
216 "--pt2e_quantize",
217 default=None,
218 choices=[
219 "xnnpack_dynamic",
220 "xnnpack_dynamic_qc4",
221 "openvino_4wo",
222 "openvino_8wo",
223 "qnn_8a8w",
224 "qnn_16a16w",
225 "qnn_16a4w",
226 "coreml_c4w",
227 "coreml_8a_c8w",
228 "coreml_8a_c4w",
229 "coreml_baseline_8a_c8w",
230 "coreml_baseline_8a_c4w",
231 "vulkan_8w",
232 "tosa_8a8w",
233 "ethosu_8a8w",
234 "vgf_8a8w",
235 "vgf_16a8w",
236 ],
237 help="Use PT2E quantization. Comma separated options. e.g. xnnpack_dynamic (for per channel 8 bit weight), xnnpack_dynamic_qc4 (for per channel 4 bit weight), embedding.",
238 )
239
240 parser.add_argument(
241 "-qmode",
242 "--quantization_mode",
243 type=_qmode_type,
244 default=None,
245 help="type of quantization",
246 )
247
248 parser.add_argument(

Callers 4

prepare_modelMethod · 0.90
mainFunction · 0.90
build_modelFunction · 0.70

Calls

no outgoing calls

Tested by 2

prepare_modelMethod · 0.72