Support passing model name without "--model" argument prefix
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
# Copyright (C) 2025 Philipp Emanuel Weidmann <pew@worldwidemann.com>
|
# Copyright (C) 2025 Philipp Emanuel Weidmann <pew@worldwidemann.com>
|
||||||
|
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
|
|
||||||
@@ -32,6 +33,16 @@ def main():
|
|||||||
)
|
)
|
||||||
print()
|
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()
|
settings = Settings()
|
||||||
|
|
||||||
# Adapted from https://github.com/huggingface/accelerate/blob/main/src/accelerate/commands/env.py
|
# Adapted from https://github.com/huggingface/accelerate/blob/main/src/accelerate/commands/env.py
|
||||||
|
|||||||
Reference in New Issue
Block a user