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

[Fix] _example_type class var being read as private attr with Pydantic V2 #15758

Merged
merged 2 commits into from
Aug 31, 2024

Conversation

nerdai
Copy link
Contributor

@nerdai nerdai commented Aug 31, 2024

Description

In Pydantic V2, fields starting with "_" are generally treated as PrivateAttr. However, if they are annotated with ClassVar then these won't be converted to pydantic PrivateAttr but rather is properly treated as a class variable. Adding this notation to the _example_type and _prediction_type of BaseLlamaDataset and BaseLlamaPredictionDataset, respectively makes these two variables properly treated as class vars as required.

Fixes #15746

New Package?

Version Bump?

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Tested the users code and it is able to download and create llama-datasets
  • I stared at the code and made sure it makes sense

@nerdai nerdai linked an issue Aug 31, 2024 that may be closed by this pull request
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 31, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 31, 2024
@nerdai nerdai merged commit 4d9552f into main Aug 31, 2024
9 checks passed
@nerdai nerdai deleted the nerdai/15746-bug-download_llama_dataset branch August 31, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: download_llama_dataset erroring on PaulGrahamEssayDataset"
2 participants