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

feat(integrations): port OpenAI WandbLogger for openai-python v1.0 #6498

Merged
merged 64 commits into from
Nov 30, 2023

Conversation

ayulockin
Copy link
Member

@ayulockin ayulockin commented Oct 25, 2023

Description

  • Fixes WB-NNNNN
  • Fixes #NNNN

What does the PR do?

This PR ports the the existing WandbLogger.sync() to wandb to make it work with openai v1.0.

The WandbLogger has the following features:

  • syncs the metrics to a W&B run
  • logs training and validation data as artifact and table
  • tracks the configs
  • works with openai v0.28.1

During the rewrite of the openai-python repo, the authors had decided that this logger should live in the wandb python package instead of the openai package. Check out the discussion here.

This PR ports the logic to this repo in the from wandb.integration.openai import WandbLogger namespace (subject to change). The implementation removes support for any openai legacy functionality and will work with v1.0.

TODO:

  • formatting
  • documentation
  • tests?
  • minor fixes to W&B Tables logging logic
image

🤖 Generated by Copilot at ce4ee24

This pull request adds a new module wandb.integration.openai that provides a class WandbLogger to integrate wandb and openai fine-tuning. It also adds a test script test_openai_finetune.py that uses the class to sync a specific fine-tuning job with wandb. The module and the script are commented and documented.

Testing

How was this PR tested?

🤖 Generated by Copilot at ce4ee24

WandbLogger class
Syncs openai fine-tuning
With wandb platform

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #6498 (c7e2636) into main (7a705a9) will decrease coverage by 0.35%.
Report is 1 commits behind head on main.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6498      +/-   ##
==========================================
- Coverage   79.48%   79.13%   -0.35%     
==========================================
  Files         415      416       +1     
  Lines       47737    47958     +221     
==========================================
+ Hits        37943    37953      +10     
- Misses       9582     9790     +208     
- Partials      212      215       +3     
Flag Coverage Δ
func 52.45% <0.00%> (-0.43%) ⬇️
system 63.82% <0.00%> (+0.51%) ⬆️
unit 60.73% <0.00%> (-0.46%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
wandb/integration/openai/__init__.py 0.00% <0.00%> (ø)
wandb/integration/openai/fine_tune.py 0.00% <0.00%> (ø)

... and 40 files with indirect coverage changes

@ayulockin ayulockin changed the title port openai WandbLogger to wandb sdk feat (integrations): port OpenAI WandbLogger for openai-python v1.0 Oct 26, 2023
test_openai_finetune.py Outdated Show resolved Hide resolved
test_openai_finetune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Show resolved Hide resolved
@dmitryduev dmitryduev added this to the sdk-2023-11.1 milestone Oct 27, 2023
@ayulockin ayulockin marked this pull request as ready for review November 1, 2023 16:25
@ayulockin ayulockin changed the title feat (integrations): port OpenAI WandbLogger for openai-python v1.0 feat(integrations): port OpenAI WandbLogger for openai-python v1.0 Nov 1, 2023
@github-actions github-actions bot removed the cc-feat label Nov 3, 2023
@github-actions github-actions bot added cc-feat and removed cc-feat labels Nov 3, 2023
@ayulockin
Copy link
Member Author

Hey @kptkin, do let me know if anything else is needed from my end to get this PR merged? Also thanks for all the detailed feedback.

wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Outdated Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Show resolved Hide resolved
wandb/integration/openai/fine_tune.py Show resolved Hide resolved
@ayulockin
Copy link
Member Author

Hey @kptkin, the PR is ready from my end. Do let me know if anything else is needed. :)

Copy link
Contributor

@kptkin kptkin left a comment

Choose a reason for hiding this comment

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

👍

@ayulockin ayulockin merged commit afffbe6 into main Nov 30, 2023
75 checks passed
@ayulockin ayulockin deleted the openai-finetuning branch November 30, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants