From 7573a2eebd867bf185ee1d6f80623f880ac78277 Mon Sep 17 00:00:00 2001 From: Philipp Emanuel Weidmann Date: Thu, 25 Sep 2025 15:02:22 +0530 Subject: [PATCH] Support passing model name without "--model" argument prefix --- src/heretic/main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/heretic/main.py b/src/heretic/main.py index 2f7f2aa..517086f 100644 --- a/src/heretic/main.py +++ b/src/heretic/main.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # Copyright (C) 2025 Philipp Emanuel Weidmann +import sys import time from importlib.metadata import version @@ -32,6 +33,16 @@ def main(): ) print() + if ( + # An odd number of arguments have been passed (argv[0] is the program name), + # so that after accounting for "--param VALUE" pairs, there is one left over. + len(sys.argv) % 2 == 0 + # The leftover argument is a parameter value rather than a flag (such as "--help"). + and not sys.argv[-1].startswith("-") + ): + # Assume the last argument is the model. + sys.argv.insert(-1, "--model") + settings = Settings() # Adapted from https://github.com/huggingface/accelerate/blob/main/src/accelerate/commands/env.py