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

Wild Time Benchmarks and Small Memory Hack #363

Merged
merged 4 commits into from
Aug 8, 2023
Merged

Conversation

wistuba
Copy link
Contributor

@wistuba wistuba commented Aug 7, 2023

Add files required to run experimentation with Wild Time Benchmarks.

Save PIL images rather than tensors in buffers to keep memory space lower.

Found bug: optimizer_fn doesn't work as intended. If it exists, it must return an optimizer. We would like that it can exist but it either returns an optimizer or None. Currently "fixed" by adding all arguments expected for an optimizer to the function.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link

github-actions bot commented Aug 7, 2023

Coverage report

The coverage rate went from 85.68% to 84.99% ⬇️

62.5% of new lines are covered.

Diff Coverage details (click to unfold)

src/renate/benchmark/experiment_config.py

100% of new lines are covered (98.4% of the complete file).

src/renate/benchmark/datasets/vision_datasets.py

0% of new lines are covered (37.03% of the complete file).
Missing lines: 71, 74, 262, 265, 387, 390

@@ -317,6 +318,8 @@ def _get_normalize_transform(dataset_name):

def train_transform(dataset_name: str) -> Optional[Callable]:
"""Returns a transform function to be used in the training."""
if dataset_name == "fmow":
return FMoW.default_transform
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to exist a default_transform(datasetname) in the package. Any reason to go this route?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point

momentum: float = 0.0, # TODO: fix problem that occurs when removing this
) -> Callable:
if optimizer == "AdamW":
return partial(AdamW, lr=learning_rate, weight_decay=weight_decay)
Copy link
Contributor

Choose a reason for hiding this comment

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

can this written as:
partial(getattr(torch.optim, optimizer), lr=learning_rate, weight_decay=weight_decay)? Why the specific handling of AdamW?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in principle there is no problem if we make it more general. however, how would that work with SGD + momentum? right now, this logic will only be triggered for AdamW and otherwise we will fall back to the standard optimizers (SGD, Adam), we have in the library.

@wistuba wistuba merged commit 38ea8a7 into dev Aug 8, 2023
18 checks passed
@wistuba wistuba deleted the mw-wildtime-experiments branch August 8, 2023 07:00
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.

None yet

2 participants