Skip to content

Commit

Permalink
Merge pull request #868 from deepmodeling/zjgemi
Browse files Browse the repository at this point in the history
fix: pass None for HDF5Datasets
  • Loading branch information
zjgemi authored Oct 18, 2024
2 parents 6d20d71 + 1310554 commit d1b395c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/dflow/python/opio.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def dataset(self):
def __deepcopy__(self, memo=None):
return self

def is_none(self):
return self.dataset.attrs.get("type") == "null"

def get_data(self):
if self.dataset.attrs.get("type") == "null":
if self.is_none():
return None
data = self.dataset[()]
if self.dataset.attrs.get("dtype") == "utf-8":
Expand Down
5 changes: 4 additions & 1 deletion src/dflow/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def handle_input_artifact(name, sign, slices=None, data_root="/tmp",
res = []
for path in path_object:
f = h5py.File(path, "r")
datasets = {k: HDF5Dataset(f, k) for k in f.keys()}
datasets = {}
for k in f.keys():
d = HDF5Dataset(f, k)
datasets[k] = None if d.is_none() else d
if set(datasets.keys()) == {str(i) for i in range(len(datasets))} \
and isinstance(res, list):
# concat when all datasets are lists
Expand Down

0 comments on commit d1b395c

Please sign in to comment.