-
Notifications
You must be signed in to change notification settings - Fork 73
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(weave): allow disabling autopatch #3442
Conversation
c3a599d
to
290c710
Compare
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=7349fce62a9b6674d4148ebf624151e1bfb0dd57 |
weave/trace/autopatch.py
Outdated
@@ -51,6 +52,11 @@ class AutopatchSettings(BaseModel): | |||
|
|||
@validate_call | |||
def autopatch(settings: Optional[AutopatchSettings] = None) -> None: | |||
if settings is None: | |||
settings = AutopatchSettings() | |||
elif settings.disable_autopatch: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would just do if
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better would be deferring autopatch until the first import so we don't even need this!
That would be better but also a lot more complicated to implement. |
290c710
to
f77fa9a
Compare
Description
Gives users the ability to disable autopatching, giving improved
weave.init
performance by almost a second if the user does not need integrations. An example use: a script that doesn't need to log any traces, like the benchmarking script included here.For discussion related to #3441
Before: Can disable individual integrations
After: Can also easily disable all integrations
Future?: Can selectively enable integrations
Integrations enabled:
Integrations disabled: