edit cmd line args

This commit is contained in:
Christian Zhou-Zheng 2024-06-08 23:00:42 -04:00
parent 079dfe3a8c
commit 282e71fb39
2 changed files with 8 additions and 16 deletions

View file

@ -2799,10 +2799,6 @@ def parse_args() -> argparse.Namespace:
"--verbose", action="store_true", "--verbose", action="store_true",
help="increase output verbosity", help="increase output verbosity",
) )
parser.add_argument(
"--split", action="store_true",
help="split the converted model into multiple files",
)
parser.add_argument( parser.add_argument(
"--split-max-tensors", type=int, "--split-max-tensors", type=int,
help="max tensors in each split", help="max tensors in each split",
@ -2816,8 +2812,8 @@ def parse_args() -> argparse.Namespace:
help="only print out a split plan and exit, without writing any new files", help="only print out a split plan and exit, without writing any new files",
) )
parser.add_argument( parser.add_argument(
"--small-first-shard", action="store_true", "--no-tensor-first-split", action="store_true",
help="do not add tensors to the first shard (disabled by default)", help="do not add tensors to the first split (disabled by default)"
) )
return parser.parse_args() return parser.parse_args()
@ -2847,9 +2843,6 @@ def main() -> None:
logger.error(f'Error: {args.model} is not a directory') logger.error(f'Error: {args.model} is not a directory')
sys.exit(1) sys.exit(1)
if args.split and not (args.split_max_tensors or args.split_max_size):
raise ValueError("Need to specify one of --split-max-tensors or --split-max-size when splitting")
if args.split_max_tensors and args.split_max_size: if args.split_max_tensors and args.split_max_size:
raise ValueError("Can't specify both --split-max-tensors and --split-max-size") raise ValueError("Can't specify both --split-max-tensors and --split-max-size")

View file

@ -48,14 +48,13 @@ class SplitStyle(IntEnum):
class SplitArguments: class SplitArguments:
def __init__(self, args: Namespace) -> None: def __init__(self, args: Namespace) -> None:
self.split = args.split self.split_max_tensors = args.split_max_tensors if args.split_max_tensors else 0
self.split_max_tensors = args.split_max_tensors if args.split else 0 self.split_max_size = GGUFWriterSplit.split_str_to_n_bytes(args.split_max_size) if args.split_max_size else 0
self.split_max_size = GGUFWriterSplit.split_str_to_n_bytes(args.split_max_size) if args.split and args.split_max_size else 0 self.split_style = SplitStyle.TENSORS if self.split_max_tensors \
self.split_style = SplitStyle.NONE if not self.split \ else SplitStyle.SIZE if self.split_max_size \
else SplitStyle.TENSORS if self.split_max_tensors \ else SplitStyle.NONE
else SplitStyle.SIZE
self.dry_run = args.dry_run self.dry_run = args.dry_run
self.small_first_shard = args.small_first_shard self.small_first_shard = args.no_tensor_first_split
class GGUFWriterSplit(GGUFWriter): class GGUFWriterSplit(GGUFWriter):