Skip to content

Commit

Permalink
Fixing issue with ConfigDict.
Browse files Browse the repository at this point in the history
Running fibad train still generates an error, but its because the default
config specifies $(pwd)/data as a data directory, and there isn't data there
that can be loaded by HSCDataLoader.
  • Loading branch information
mtauraso committed Oct 8, 2024
1 parent 6207ebc commit 226f576
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/fibad/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class ConfigDict(dict):

__slots__ = () # we don't need __dict__ on this object at all.

def __init__(self, map: dict, **kwargs):
super().__init__(map, **kwargs)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# Replace all dictionary keys with values recursively.
for key in self:
if isinstance(self[key], dict) and not isinstance(self[key], ConfigDict):
self[key] = ConfigDict(map=self[key])
for key, val in self.items():
if isinstance(val, dict) and not isinstance(val, ConfigDict):
self[key] = ConfigDict(val)

def __missing__(self, key):
msg = f"Accessed configuration key/section {key} which has not been defined. "
Expand Down
2 changes: 1 addition & 1 deletion src/fibad/fibad_default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ latent_dim =64
[data_set]
# Name of the built-in data loader to use or the libpath to an external data loader
# e.g. "user_package.submodule.ExternalDataLoader" or "HSCDataLoader"
name = "HSCDataLoader"
name = "HSCDataSet"

[data_loader]
# Pixel dimensions used to crop all images prior to loading. Will prune any images that are too small.
Expand Down

0 comments on commit 226f576

Please sign in to comment.