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

updated: model_kwargs handling for evaluation model #1133

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
7 changes: 3 additions & 4 deletions langtest/modelhandler/llm_modelhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ def load_model(cls, hub: str, path: str, *args, **kwargs) -> "PretrainedModelFor
model = AzureChatOpenAI(model=path, *args, **filtered_kwargs)

return cls(hub, model, *args, **filtered_kwargs)
# elif hub == "ollama":
# from langchain.chat_models.ollama import ChatOllama

# model = ChatOllama(model=path, *args, **filtered_kwargs)
# return cls(hub, model, *args, **filtered_kwargs)
else:
from .utils import CHAT_MODEL_CLASSES

Expand All @@ -136,6 +132,9 @@ def load_model(cls, hub: str, path: str, *args, **kwargs) -> "PretrainedModelFor
cls.model = model(model_id=path, *args, **filtered_kwargs)
elif "repo_id" in default_args:
cls.model = model(repo_id=path, model_kwargs=filtered_kwargs)
# mapping path dict to model object
else:
cls.model = model(**path)
return cls(hub, cls.model, *args, **filtered_kwargs)

except ImportError:
Expand Down
7 changes: 6 additions & 1 deletion langtest/utils/custom_types/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,17 @@ def __update_params(self):
if harness_config["evaluation"]["metric"].lower() == "llm_eval":
model = harness_config["evaluation"].get("model", None)
hub = harness_config["evaluation"].get("hub", None)
model_parameters = harness_config["evaluation"].get(
"model_parameters", None
)
if model_parameters is None:
model_parameters = harness_config.get("model_parameters", {})
if model and hub:
from ...tasks import TaskManager

load_eval_model = TaskManager(self.task)
self.eval_model = load_eval_model.model(
model, hub, **harness_config.get("model_parameters", {})
model, hub, **model_parameters
)

else:
Expand Down
Loading