Read GGUF metadata (#3873)

This commit is contained in:
oobabooga 2023-09-11 18:49:30 -03:00 committed by GitHub
parent 39f4800d94
commit 9331ab4798
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 154 additions and 52 deletions

View file

@ -18,9 +18,9 @@ from transformers import (
)
import modules.shared as shared
from modules import llama_attn_hijack, RoPE, sampler_hijack
from modules import RoPE, llama_attn_hijack, sampler_hijack
from modules.logging_colors import logger
from modules.models_settings import infer_loader
from modules.models_settings import get_model_metadata
transformers.logging.set_verbosity_error()
@ -62,15 +62,11 @@ def load_model(model_name, loader=None):
'ctransformers': ctransformers_loader,
}
p = Path(model_name)
if p.exists():
model_name = p.parts[-1]
if loader is None:
if shared.args.loader is not None:
loader = shared.args.loader
else:
loader = infer_loader(model_name)
loader = get_model_metadata(model_name)['loader']
if loader is None:
logger.error('The path to the model does not exist. Exiting.')
return None, None