Skip to content

Fix: Use default_factory for splits and make char fields optional in DatasetConstants #219

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jihobak
Copy link

@jihobak jihobak commented Mar 25, 2025

In my opinion, many users will utilize this script to experiment with their own datasets for training. However, the original DatasetConstants class had two main issues:

  1. The 'splits' attribute was declared as a class variable, causing it to be shared among all instances. This could lead to unexpected side effects.
  2. The char fields (chars_per_sample and chars_per_token) were required, which could be inconvenient for some executions.

Changes

  • Updated the 'splits' attribute to use field(default_factory=dict), ensuring each DatasetConstants instance gets its own independent dictionary.
  • Changed the type hints for chars_per_sample and chars_per_token to Optional[int] with default values of None, making these parameters optional and the script more flexible.

This change is essential to avoid potential time waste for users who might otherwise encounter unexpected behavior when running the script on their own datasets.

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.

1 participant