1921 & GSK-1851 & GSK-1901 - save langchain chain without ml flow to reduce compatibility#1490
Conversation
|
GSK-1851 Add support for QA retriever upload in LLM Hub GSK-1901 solve serialisability issue
from mattbit: |
| def save_model(self, local_path, mlflow_meta): | ||
| mlflow.langchain.save_model(self.model, path=local_path, mlflow_model=mlflow_meta) | ||
| def save(self, local_path: Union[str, Path]) -> None: | ||
| super().save(local_path) |
There was a problem hiding this comment.
the idea of factoring out save_model from save is that you shouldn't have to overwrite save, save_model is by default always called by BaseModel.save so I think you're calling it twice in this.
There was a problem hiding this comment.
Well actually save_model isn't called in neither WrapperModel nor BaseModel
There was a problem hiding this comment.
Oh, you're right, my bad. I relied on my memory instead of looking at the code. I thought we had the same logic as model_predict and predict, but indeed we kept save loose I think because of the ordering of the saving.
|
|
||
| def model_predict(self, df): | ||
| return [self.model.predict(**data) for data in df.to_dict("records")] | ||
| generations = [self.model(data) for data in df.to_dict("records")] |
There was a problem hiding this comment.
These backward incompatible API changes from LangChain make me nervous. Could you please make sure that our code works for all the versions of LangChain we support in pyproject.toml?
There was a problem hiding this comment.
It's actually a bug fix. The former method only works with LLMChain while the new one works with any type extending Chain, this will continue to work with models uploaded with previous version
There was a problem hiding this comment.
Is it related to this as well you think? https://linear.app/giskard/issue/GSK-1819/set-a-minimum-on-langchains-version
…t-ml_flow-to-reduce-compatibility
…t-ml_flow-to-reduce-compatibility
rabah-khalek
left a comment
There was a problem hiding this comment.
Looks good to me now @kevinmessiaen, thanks!
|
Kudos, SonarCloud Quality Gate passed! |








Description
Save and load
LangchainModelusing langchain provided methods instead of ml_flowRelated Issue
Type of Change