-
Notifications
You must be signed in to change notification settings - Fork 17
[WIP] Intermediate Tutorial #30
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
base: main
Are you sure you want to change the base?
Conversation
@tkornuta-nvidia I'm testing the What are the thoughts on supporting the By the way, one other thing I've noticed: Logic like this, IMO, doesn't really deserve to live in the main file: if use_cuda:
cuda_kwargs = {"num_workers": 1, "pin_memory": True, "shuffle": True}
train_kwargs.update(cuda_kwargs)
test_kwargs.update(cuda_kwargs) What would be really cool is to support a conditional config. I know that's not possible with hydra at the moment, but something like: @dataclass
class MNISTConf:
no_cuda: bool = False
...
checkpoint_name: str = "unnamed.pt"
data_train: DataLoaderConf = DataLoaderConf(
shuffle = True,
num_workers = 0 if {no_cuda} else 1,
pin_memory = False
)
data_test: DataLoaderConf = DataLoaderConf(
shuffle = False,
num_workers = 0 if {no_cuda} else 1
)
model: MNISTNetConf = MNISTNetConf()
...
) |
Yeah, this is definitely not great. |
###### HYDRA BLOCK ###### # noqa: E266 | ||
import hydra | ||
from hydra.core.config_store import ConfigStore | ||
from dataclasses import dataclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this HYDRA BLOCK this is a good idea.
imports should be sorted normally. We can call out in the text what things are specific to Hydra.
I wouldn't like to see people copying this HYDRA BLOCK as if it's somehow needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ok. I was thinking its nice to fence off the code so it is clear what the diffs are. Maybe I can instead annotate it as a 'DIFF' block.
@@ -32,13 +31,13 @@ class MNISTConf: | |||
adadelta: AdadeltaConf = AdadeltaConf() | |||
steplr: StepLRConf = StepLRConf( | |||
step_size=1 | |||
) # we pass a default for step_size since it is required, but missing a default in PyTorch (and consequently in hydra-torch) | |||
) # we pass a default for step_size since it is required, but missing a default in PyTorch (and consequently in hydra-torch) # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just break the comment into multiple lines?
No description provided.