()
| 11035 | |
| 11036 | |
| 11037 | def parse_args() -> argparse.Namespace: |
| 11038 | parser = argparse.ArgumentParser( |
| 11039 | description="Convert a huggingface model to a GGML compatible file") |
| 11040 | parser.add_argument( |
| 11041 | "--vocab-only", action="store_true", |
| 11042 | help="extract only the vocab", |
| 11043 | ) |
| 11044 | parser.add_argument( |
| 11045 | "--outfile", type=Path, |
| 11046 | help="path to write to; default: based on input. {ftype} will be replaced by the outtype.", |
| 11047 | ) |
| 11048 | parser.add_argument( |
| 11049 | "--outtype", type=str, choices=["f32", "f16", "bf16", "q8_0", "tq1_0", "tq2_0", "auto"], default="auto", |
| 11050 | help="output format - use f32 for float32, f16 for float16, bf16 for bfloat16, q8_0 for Q8_0, tq1_0 or tq2_0 for ternary, and auto for the highest-fidelity 16-bit float type", |
| 11051 | ) |
| 11052 | parser.add_argument( |
| 11053 | "--bigendian", action="store_true", |
| 11054 | help="model is executed on big endian machine", |
| 11055 | ) |
| 11056 | parser.add_argument( |
| 11057 | "model", type=str, |
| 11058 | help="directory containing model file or huggingface repository ID (if --remote)", |
| 11059 | nargs="?", |
| 11060 | ) |
| 11061 | parser.add_argument( |
| 11062 | "--use-temp-file", action="store_true", |
| 11063 | help="use the tempfile library while processing (helpful when running out of memory, process killed)", |
| 11064 | ) |
| 11065 | parser.add_argument( |
| 11066 | "--no-lazy", action="store_true", |
| 11067 | help="use more RAM by computing all outputs before writing (use in case lazy evaluation is broken)", |
| 11068 | ) |
| 11069 | parser.add_argument( |
| 11070 | "--model-name", type=str, default=None, |
| 11071 | help="name of the model", |
| 11072 | ) |
| 11073 | parser.add_argument( |
| 11074 | "--verbose", action="store_true", |
| 11075 | help="increase output verbosity", |
| 11076 | ) |
| 11077 | parser.add_argument( |
| 11078 | "--split-max-tensors", type=int, default=0, |
| 11079 | help="max tensors in each split", |
| 11080 | ) |
| 11081 | parser.add_argument( |
| 11082 | "--split-max-size", type=str, default="0", |
| 11083 | help="max size per split N(M|G)", |
| 11084 | ) |
| 11085 | parser.add_argument( |
| 11086 | "--dry-run", action="store_true", |
| 11087 | help="only print out a split plan and exit, without writing any new files", |
| 11088 | ) |
| 11089 | parser.add_argument( |
| 11090 | "--no-tensor-first-split", action="store_true", |
| 11091 | help="do not add tensors to the first split (disabled by default)" |
| 11092 | ) |
| 11093 | parser.add_argument( |
| 11094 | "--metadata", type=Path, |
no test coverage detected