Make --model work with absolute paths, eg --model /tmp/gemma-3-270m-it-IQ4_NL.gguf

This commit is contained in:
oobabooga 2025-08-22 11:46:02 -07:00
parent fd41f2fafc
commit f247c2ae62
4 changed files with 35 additions and 19 deletions

View file

@ -86,6 +86,19 @@ def check_model_loaded():
return True, None
def resolve_model_path(model_name_or_path):
"""
Resolves a model path, checking for a direct path
before the default models directory.
"""
path_candidate = Path(model_name_or_path)
if path_candidate.exists():
return path_candidate
else:
return Path(f'{shared.args.model_dir}/{model_name_or_path}')
def get_available_models():
# Get all GGUF files
gguf_files = get_available_ggufs()