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

Log dataset sizes #246

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/metatrain/cli/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,31 @@ def train_model(
)
validation_datasets.append(validation_dataset)

###########################
# PRINT DATASET STATS #####
###########################

for i, train_dataset in enumerate(train_datasets):
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also print this directlty below we load the datasets instead of here. But I don't mind much.

Copy link
Collaborator Author

@frostedoyster frostedoyster Jun 11, 2024

Choose a reason for hiding this comment

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

I think this is better as a new section anticipating when we will print all the stats (standard deviations etc)

if len(train_datasets) == 1:
index = ""
else:
index = f" {i}"
logger.info(f"Training dataset{index} has size {len(train_dataset)}")

for i, validation_dataset in enumerate(validation_datasets):
if len(validation_datasets) == 1:
index = ""
else:
index = f" {i}"
logger.info(f"Validation dataset{index} has size {len(validation_dataset)}")

for i, test_dataset in enumerate(test_datasets):
if len(test_datasets) == 1:
index = ""
else:
index = f" {i}"
logger.info(f"Test dataset{index} has size {len(test_dataset)}")

###########################
# SAVE EXPANDED OPTIONS ###
###########################
Expand Down
3 changes: 3 additions & 0 deletions tests/cli/test_train_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def test_train(capfd, monkeypatch, tmp_path, output):
for logtext in [stdout_log, file_log]:
assert "This log is also available"
assert re.search(r"Random seed of this run is [1-9]\d*", logtext)
assert "Training dataset has size"
assert "Validation dataset has size"
assert "Test dataset has size"
assert "[INFO]" in logtext
assert "Epoch" in logtext
assert "loss" in logtext
Expand Down
Loading