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

Callback Handler for MLflow #4150

Merged
merged 8 commits into from
May 11, 2023

Conversation

akshaya-a
Copy link
Contributor

Rebased Mahmedk's PR with the callback refactor and added the example requested by hwchase plus a couple minor fixes

mahmedk and others added 5 commits May 4, 2023 16:31
Implementation of callback handler for one of the most popular mlops platform - mlflow.
Inspired by wandb_callback handler.
This handler logs the metrics and artifacts to the mlflow server.
Update code to report metrics in batch
Support to include 'step' in the metric
- Added support to report chain assets using mlflow.langchain.log_model. Using log_artifact for other types.
- Fixed 'input' key error when prompt templates are used.
- Improved the reporting logic by using mlflow active run context
- Added support to report chain assets using mlflow.langchain.log_model. Using log_artifact for other types.
- Fixed 'input' key error when prompt templates are used.
- Improved the reporting logic by using mlflow active run context

Add example notebook and fix
@akshaya-a
Copy link
Contributor Author

akshaya-a commented May 5, 2023

@mahmedk if you don't mind, I didn't have write permissions on your fork so I added the sample notebook while preserving your commits so you get the credit in the commit history :) EDIT: and I've added you as a collaborator on my fork in case you want to update it!

@hwchase17 this includes the sample notebook you requested and I've tested it works with the local MLflow tracking store

@hwchase17 hwchase17 requested a review from agola11 May 5, 2023 06:04
langchain/chains/base.py Outdated Show resolved Hide resolved
@akshaya-a akshaya-a requested a review from agola11 May 9, 2023 22:45
@akshaya-a
Copy link
Contributor Author

@agola11 thanks for the review and apologies for not following the contributions instructions earlier - I've run the make lint + format now so things should be happy (and removed my change from Chain base).

After this PR, I am willing to add a few more tests in a follow up - are you willing to add mlflow + azureml-mlflow packages as test dependencies or should we explore some other options?

Copy link
Contributor

@dbczumar dbczumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@dbczumar dbczumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev2049 and others added 2 commits May 10, 2023 22:39
Co-authored-by: Corey Zumar <39497902+dbczumar@users.noreply.github.com>
@dev2049 dev2049 merged commit b21d7c1 into langchain-ai:master May 11, 2023
@akshaya-a akshaya-a deleted the ak/mlflow-callback-refactor branch May 11, 2023 16:30
jpzhangvincent pushed a commit to jpzhangvincent/langchain that referenced this pull request May 12, 2023
Rebased Mahmedk's PR with the callback refactor and added the example
requested by hwchase plus a couple minor fixes

---------

Co-authored-by: Ahmed K <77802633+mahmedk@users.noreply.github.com>
Co-authored-by: Ahmed K <mda3k27@gmail.com>
Co-authored-by: Davis Chase <130488702+dev2049@users.noreply.github.com>
Co-authored-by: Corey Zumar <39497902+dbczumar@users.noreply.github.com>
Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
EandrewJones pushed a commit to Oogway-Technologies/langchain that referenced this pull request May 12, 2023
Rebased Mahmedk's PR with the callback refactor and added the example
requested by hwchase plus a couple minor fixes

---------

Co-authored-by: Ahmed K <77802633+mahmedk@users.noreply.github.com>
Co-authored-by: Ahmed K <mda3k27@gmail.com>
Co-authored-by: Davis Chase <130488702+dev2049@users.noreply.github.com>
Co-authored-by: Corey Zumar <39497902+dbczumar@users.noreply.github.com>
Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
@mahmedk
Copy link
Contributor

mahmedk commented May 16, 2023

@mahmedk if you don't mind, I didn't have write permissions on your fork so I added the sample notebook while preserving your commits so you get the credit in the commit history :) EDIT: and I've added you as a collaborator on my fork in case you want to update it!

@hwchase17 this includes the sample notebook you requested and I've tested it works with the local MLflow tracking store

@akshaya-a thanks much ! Sorry, I could not attend to this work for past couple of weeks due to internal commitments. Glad to see the PR getting merged and mlflow support in langchain. Thanks Again :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants