mirror of
https://github.com/p-e-w/heretic.git
synced 2026-07-09 17:28:29 +00:00
Support passing model name without "--model" argument prefix
This commit is contained in:
parent
fd0fa52552
commit
7573a2eebd
1 changed files with 11 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (C) 2025 Philipp Emanuel Weidmann <pew@worldwidemann.com>
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue