Unverified Commit 6255c95a authored by Rhett Ying's avatar Rhett Ying Committed by GitHub
Browse files

[Fix] too many open files (#3694)

* [Fix] too many open files
parent 05c6c3c5
......@@ -155,5 +155,11 @@ class DistDataLoader:
end_pos = self.current_pos + self.batch_size
idx = self.data_idx[self.current_pos:end_pos].tolist()
ret = [self.dataset[i] for i in idx]
# Sharing large number of tensors between processes will consume too many
# file descriptors, so let's convert each tensor to scalar value beforehand.
if isinstance(ret[0], tuple):
ret = [(type, F.as_scalar(id)) for (type, id) in ret]
else:
ret = [F.as_scalar(id) for id in ret]
self.current_pos = end_pos
return ret
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment