Skip to content

Commit

Permalink
Merge pull request #1145 from JohnSnowLabs/fix/basic-setup-within-dat…
Browse files Browse the repository at this point in the history
…rabricks-using-azure-openai

fix: enhance model loading logic and update dependencies for
  • Loading branch information
chakravarthik27 authored Nov 23, 2024
2 parents 21a9d2b + aa9b2aa commit 3523005
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 133 deletions.
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

0 comments on commit 3523005

Please sign in to comment.