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

Fix starter #227

Merged
merged 2 commits into from
Apr 5, 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
9 changes: 7 additions & 2 deletions dacapo/experiments/starts/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,13 @@ def __init__(self, start_config):
Start class with specified config to run the initialization of
weights for a model associated with a specific criterion.
"""
self.run = start_config.run
self.criterion = start_config.criterion
# Old version return a dict, new version return an object, this line is to support both
if isinstance(start_config, dict):
self.run = start_config["run"]
self.criterion = start_config["criterion"]
else:
self.run = start_config.run
self.criterion = start_config.criterion

self.channels = None

Expand Down
13 changes: 9 additions & 4 deletions dacapo/store/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ def __typed_structure(self, obj_data, cls, cls_fn):
to determine the class. This is useful for reconstructing a concrete
class from unstructured data.
"""

cls = cls_fn(obj_data["__type__"])
structure_fn = make_dict_structure_fn(cls, self)
return structure_fn(obj_data, cls)
try:
cls = cls_fn(obj_data["__type__"])
structure_fn = make_dict_structure_fn(cls, self)
return structure_fn(obj_data, cls)
except:
print(
f"Could not structure object of type {obj_data}. will try unstructured data. attr __type__ can be missing because of old version of the data."
)
return obj_data


# The global converter object, to be used by stores to convert objects into
Expand Down
Loading