-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
Community: In case of serialized
is NoneType return empty Dict for transform_run
of WanDB Tracer
#27947
Community: In case of serialized
is NoneType return empty Dict for transform_run
of WanDB Tracer
#27947
Conversation
keenborder786
commented
Nov 6, 2024
- Description: Solves the following issue:
- Issue: Bug in langchain_community/callbacks/tracers/wandb.py: 'NoneType' object has no attribute 'items' #27909
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@@ -191,14 +191,16 @@ def transform_serialized(serialized: Dict[str, Any]) -> Dict[str, Any]: | |||
serialized = remove_exact_and_partial_keys(serialized) | |||
return serialized | |||
|
|||
def transform_run(run: Dict[str, Any]) -> Dict[str, Any]: | |||
def transform_run(run: Dict[str, Any]) -> Dict: |
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.
Why was this removed?
def transform_run(run: Dict[str, Any]) -> Dict: | |
def transform_run(run: Dict[str, Any]) -> Dict[str, Any]: |
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.
@eyurtsev because we are returning an empty dict otherwise the linter raises an error
"""Transforms a run dictionary to be compatible with WBTraceTree. | ||
:param run: The run dictionary to transform. | ||
:return: The transformed run dictionary. | ||
""" | ||
transformed_dict = transform_serialized(run) | ||
|
||
serialized = transformed_dict.pop("serialized") | ||
if not serialized: | ||
return {} |
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.
This fix isn't correct as far as I can tell -- at least from reading this function code alone (i.e.,
without reading the contents of transform_serialized, there's no way to to determine that this code is written correctly).
Either missing doc-string to explain why empty dict OK or else need to handle case when name / kind are defined but serialized is not available
cc @parambharat
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.
@eyurtsev I was not able to find any other way to make it work
@parambharat please review or advice on what you want to do w/ respect to users using the community wandb tracer |
1 similar comment
Closing but will re-open pending review from @parambharat. |