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 for multiprocessing with npz file #6

Merged
merged 1 commit into from
Sep 27, 2023
Merged
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
10 changes: 6 additions & 4 deletions src/openqdc/datasets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ def read_preprocess(self):
for key in ["name", "subset"]:
filename = p_join(self.preprocess_path, f"{key}.npz")
pull_locally(filename)
# with open(filename, "rb") as f:
self.data[key] = np.load(open(filename, "rb"))
for k in self.data[key]:
print(f"Loaded {key}_{k} with shape {self.data[key][k].shape}, dtype {self.data[key][k].dtype}")
self.data[key] = dict()
with open(filename, "rb") as f:
tmp = np.load(f)
for k in tmp:
self.data[key][k] = tmp[k]
print(f"Loaded {key}_{k} with shape {self.data[key][k].shape}, dtype {self.data[key][k].dtype}")

def is_preprocessed(self):
predicats = [copy_exists(p_join(self.preprocess_path, f"{key}.mmap")) for key in self.data_keys]
Expand Down
Loading