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

Migrate to pydantic 2.0+ #73

Merged
merged 8 commits into from
Oct 10, 2024
Merged

Migrate to pydantic 2.0+ #73

merged 8 commits into from
Oct 10, 2024

Conversation

hmacdope
Copy link
Contributor

Fixes #72

Status

  • Ready to go

@hmacdope
Copy link
Contributor Author

@kaminow could I grab a review here? This should allow us to migrate nicely and unblock downstream, but please double check everything still works as expected for configs.

@hmacdope hmacdope requested a review from kaminow October 10, 2024 04:29
Copy link
Collaborator

@kaminow kaminow left a comment

Choose a reason for hiding this comment

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

one thing to address but otherwise looks good. thanks for doing this!

mtenn/config.py Outdated

# Adjust any length 1 list to be the right length
for p, list_len in list_lens.items():
if list_len == 1:
values[p] = values[p] * num_layers

return values
return self.__dict__.update(values)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think update actually returns anything

Suggested change
return self.__dict__.update(values)
self.__dict__.update(values)
return self.__dict__

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that you mention it we should return self

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is due to how the after mode validator works in pydantic 2.

@hmacdope hmacdope merged commit 36b9f8b into main Oct 10, 2024
6 of 7 checks passed
@hmacdope hmacdope deleted the pydantic_2.0 branch October 10, 2024 20:06
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.

Bump to pydantic 2.0+
2 participants