Skip to content

Commit fd73029

Browse files
cebtenzzrepkrmf
authored andcommitted
convert : make ftype optional in simple scripts (ggml-org#3185)
1 parent 445c8e8 commit fd73029

File tree

3 files changed

+48
-12
lines changed

3 files changed

+48
-12
lines changed

convert-baichuan-hf-to-gguf.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,22 @@ def count_model_parts(dir_model: str) -> int:
5757

5858
def parse_args() -> argparse.Namespace:
5959
parser = argparse.ArgumentParser(description="Convert a HuggingFace LLaMA model to a GGML compatible file")
60-
parser.add_argument("--vocab-only", action="store_true", help="extract only the vocab")
61-
parser.add_argument("--outfile", type=Path, help="path to write to; default: based on input")
62-
parser.add_argument("model", type=Path, help="directory containing model file, or model file itself (*.bin)")
63-
parser.add_argument("ftype", type=int, choices=[0, 1], help="output format - use 0 for float32, 1 for float16", default = 1)
60+
parser.add_argument(
61+
"--vocab-only", action="store_true",
62+
help="extract only the vocab",
63+
)
64+
parser.add_argument(
65+
"--outfile", type=Path,
66+
help="path to write to; default: based on input",
67+
)
68+
parser.add_argument(
69+
"model", type=Path,
70+
help="directory containing model file, or model file itself (*.bin)",
71+
)
72+
parser.add_argument(
73+
"ftype", type=int, choices=[0, 1], default=1, nargs='?',
74+
help="output format - use 0 for float32, 1 for float16",
75+
)
6476
return parser.parse_args()
6577

6678
args = parse_args()

convert-falcon-hf-to-gguf.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,22 @@ def count_model_parts(dir_model: Path) -> int:
5555

5656
def parse_args() -> argparse.Namespace:
5757
parser = argparse.ArgumentParser(description="Convert a Falcon model to a GGML compatible file")
58-
parser.add_argument("--vocab-only", action="store_true", help="extract only the vocab")
59-
parser.add_argument("--outfile", type=Path, help="path to write to; default: based on input")
60-
parser.add_argument("model", type=Path, help="directory containing model file, or model file itself (*.bin)")
61-
parser.add_argument("ftype", type=int, help="output format - use 0 for float32, 1 for float16", choices=[0, 1], default = 1)
58+
parser.add_argument(
59+
"--vocab-only", action="store_true",
60+
help="extract only the vocab",
61+
)
62+
parser.add_argument(
63+
"--outfile", type=Path,
64+
help="path to write to; default: based on input",
65+
)
66+
parser.add_argument(
67+
"model", type=Path,
68+
help="directory containing model file, or model file itself (*.bin)",
69+
)
70+
parser.add_argument(
71+
"ftype", type=int, choices=[0, 1], default=1, nargs='?',
72+
help="output format - use 0 for float32, 1 for float16",
73+
)
6274
return parser.parse_args()
6375

6476
args = parse_args()

convert-gptneox-hf-to-gguf.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,22 @@ def count_model_parts(dir_model: Path) -> int:
5656

5757
def parse_args() -> argparse.Namespace:
5858
parser = argparse.ArgumentParser(description="Convert a GPT-NeoX model to a GGML compatible file")
59-
parser.add_argument("--vocab-only", action="store_true", help="extract only the vocab")
60-
parser.add_argument("--outfile", type=Path, help="path to write to; default: based on input")
61-
parser.add_argument("model", type=Path, help="directory containing model file, or model file itself (*.bin)")
62-
parser.add_argument("ftype", type=int, choices=[0, 1], help="output format - use 0 for float32, 1 for float16", default = 1)
59+
parser.add_argument(
60+
"--vocab-only", action="store_true",
61+
help="extract only the vocab",
62+
)
63+
parser.add_argument(
64+
"--outfile", type=Path,
65+
help="path to write to; default: based on input",
66+
)
67+
parser.add_argument(
68+
"model", type=Path,
69+
help="directory containing model file, or model file itself (*.bin)",
70+
)
71+
parser.add_argument(
72+
"ftype", type=int, choices=[0, 1], default=1, nargs='?',
73+
help="output format - use 0 for float32, 1 for float16",
74+
)
6375
return parser.parse_args()
6476

6577
args = parse_args()

0 commit comments

Comments
 (0)