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

fix: enhance model loading logic and update dependencies for #1145

Merged
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions langtest/modelhandler/llm_modelhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,15 @@ def load_model(cls, hub: str, path: str, *args, **kwargs) -> "PretrainedModelFor
from .utils import CHAT_MODEL_CLASSES

if model_type and hub in CHAT_MODEL_CLASSES:
hub_module = getattr(chat_models, hub)
model = getattr(hub_module, CHAT_MODEL_CLASSES[hub])
elif model_type in [None, "instruct"]:
if hasattr(chat_models, hub):
hub_module = getattr(chat_models, hub)
model = getattr(hub_module, CHAT_MODEL_CLASSES[hub])
elif hasattr(chat_models, CHAT_MODEL_CLASSES[hub]):
model = getattr(chat_models, CHAT_MODEL_CLASSES[hub])
else:
raise ValueError(Errors.E044(path=path))

elif model_type in [None, "completion"]:
model = getattr(lc, LANGCHAIN_HUBS[hub])
else:
raise ValueError(
Expand Down
Loading
Loading