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

Add DatasetConfig #353

Merged
merged 32 commits into from
Nov 15, 2022
Merged

Add DatasetConfig #353

merged 32 commits into from
Nov 15, 2022

Conversation

asogaard
Copy link
Collaborator

@asogaard asogaard commented Nov 12, 2022

Similar to ModelConfig.

Can be used for dataset configuration as code, thereby making dataset construction more transparent and reproducible.

Examples:

# In one session, do:
>>> dataset = Dataset(...)
>>> dataset.config.dump()
path: (...)
pulsemaps:
  - (...)
(...)
>>> dataset.config.dump("dataset.yml")

# In another session, you can then do:
>>> dataset = Dataset.from_config("dataset.yml")

# Or identically:
>>> dataset = DatasetConfig.load("dataset.yml").construct_dataset()

# Uniquely for `DatasetConfig`, you can also define and load multiple datasets
>>> dataset.config.selection = {
    "train": "event_no % 2 == 0", 
    "test": "event_no % 2 == 1",
}
>>> dataset.config.dump("dataset.yml")
>>> datasets: Dict[str, Dataset] = Dataset.from_config("dataset.yml")
>>> datasets
{
    "train": Dataset(...),
    "test": Dataset(...),
}

@asogaard
Copy link
Collaborator Author

Hi @RasmusOrsoe,
This should be ready for scrutiny now. :) The DatasetConfig and ModelConfig classes will be central to #262, which I am working on in parallel, since it will allow us to do all of the data and model configuration separately from the training scripts, and share these configs between scripts and developers.

Copy link
Collaborator

@RasmusOrsoe RasmusOrsoe left a comment

Choose a reason for hiding this comment

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

Really, really cool!

@asogaard asogaard merged commit 5291660 into graphnet-team:main Nov 15, 2022
@asogaard asogaard deleted the data-config branch November 15, 2022 13:12
RasmusOrsoe pushed a commit to RasmusOrsoe/graphnet that referenced this pull request Oct 25, 2023
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.

2 participants