-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switching to Dataset based modularity (#76)
- data_loader_registry is now data_set_registry - Everything custom data loader is now data set - [data_loader] config now read in only one place (when we make the pytorch ignite data loader) - [data_set] config used to set which data set you are using. - train and predict verbs work.
- Loading branch information
Showing
10 changed files
with
87 additions
and
120 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .data_set_registry import DATA_SET_REGISTRY, fibad_data_set | ||
from .example_cifar_data_set import CifarDataSet | ||
from .hsc_data_set import HSCDataSet | ||
|
||
__all__ = ["fibad_data_set", "DATA_SET_REGISTRY", "CifarDataSet", "HSCDataSet"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ruff: noqa: D101, D102 | ||
import torchvision.transforms as transforms | ||
from torchvision.datasets import CIFAR10 | ||
|
||
from .data_set_registry import fibad_data_set | ||
|
||
|
||
@fibad_data_set | ||
class CifarDataSet(CIFAR10): | ||
"""This is simply a version of CIFAR10 that has our needed shape method, and is initialized using | ||
FIBAD config with a transformation that works well for example code. | ||
""" | ||
|
||
def __init__(self, config): | ||
transform = transforms.Compose( | ||
[transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))] | ||
) | ||
super().__init__(root=config["general"]["data_dir"], train=True, download=True, transform=transform) | ||
|
||
def shape(self): | ||
return (3, 32, 32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.