Skip to content
Snippets Groups Projects
Commit 222a8dbd authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[data_loaders] Make DataLoader pickable

This will allow to pass an instance of it in
a queue when using the multiprocessing module.
parent 5187681a
No related branches found
No related tags found
1 merge request!71Implement multiprocessing support for CachedDataSource
......@@ -310,6 +310,17 @@ class DataLoader(object):
return (result, indices[0], indices[1])
def __getstate__(self):
state = self.__dict__.copy()
# reset the data cached as its content is not pickable
for infos in state["infos"].values():
infos["data"] = None
infos["start_index"] = -1
infos["end_index"] = -1
return state
# ----------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment