Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert : add --print-supported-models option #11172

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion convert_hf_to_gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ def func(modelcls: AnyModel) -> AnyModel:
return modelcls
return func

@classmethod
def print_registered_models(cls):
for name in cls._model_classes.keys():
logger.error(f"- {name}")

@classmethod
def from_model_architecture(cls, arch: str) -> type[Model]:
try:
Expand Down Expand Up @@ -4929,6 +4934,7 @@ def parse_args() -> argparse.Namespace:
parser.add_argument(
"model", type=Path,
help="directory containing model file",
nargs="?",
)
parser.add_argument(
"--use-temp-file", action="store_true",
Expand Down Expand Up @@ -4966,8 +4972,15 @@ def parse_args() -> argparse.Namespace:
"--metadata", type=Path,
help="Specify the path for an authorship metadata override file"
)
parser.add_argument(
"--print-supported-models", action="store_true",
help="Print the supported models"
)

return parser.parse_args()
args = parser.parse_args()
if not args.print_supported_models and args.model is None:
parser.error("the following arguments are required: model")
return args


def split_str_to_n_bytes(split_str: str) -> int:
Expand All @@ -4991,6 +5004,11 @@ def split_str_to_n_bytes(split_str: str) -> int:
def main() -> None:
args = parse_args()

if args.print_supported_models:
logger.error("Supported models:")
Model.print_registered_models()
sys.exit(0)

if args.verbose:
logging.basicConfig(level=logging.DEBUG)
else:
Expand Down
Loading