-
-
Notifications
You must be signed in to change notification settings - Fork 718
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
Serialization family to preserve headers of the underlying dumps functions. #5380
Conversation
Notice, I have changed the test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @madsbk! It looks like there's another spot we need to insert ["sub-headers"]
____________________________ test_deserialize_grad _____________________________
def test_deserialize_grad():
a = np.random.rand(8, 1)
t = torch.tensor(a, requires_grad=True, dtype=torch.float)
> t2 = deserialize(*serialize(t))
distributed/protocol/tests/test_torch.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
distributed/protocol/serialize.py:410: in deserialize
return loads(header, frames)
distributed/protocol/serialize.py:50: in dask_loads
return loads(header["sub-header"], frames)
distributed/protocol/torch.py:36: in deserialize_torch_Tensor
x = dask_deserialize.dispatch(np.ndarray)(header, frames)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
header = {'device': 'cpu', 'requires_grad': True, 'serializer': 'dask', 'sub-header': {'dtype': (0, '<f4'), 'shape': (8, 1), 'strides': (4, 4), 'writeable': [True]}, ...}
frames = [<memory at 0x13abbdb80>]
@dask_deserialize.register(np.ndarray)
def deserialize_numpy_ndarray(header, frames):
with log_errors():
if header.get("pickle"):
return pickle.loads(frames[0], buffers=frames[1:])
(frame,) = frames
> (writeable,) = header["writeable"]
E KeyError: 'writeable'
distributed/protocol/numpy.py:116: KeyError
@jakirkham would you have time to take a look at this PR?
Thanks, the |
@jrbourbeau, were you just wanting feedback on that test failure or was there something else you were looking for? |
Hmm, |
As far as I can see, the CI errors isn't related to this PR.
|
@jrbourbeau, I think this is ready to be merged. |
@jrbourbeau was there anything else we needed to do here or is this good to go? |
@jrbourbeau it would be good to get this merged, it is blocking Dask-CUDA: rapidsai/dask-cuda#746 |
Going to merge to unblock Dask-CUDA. The PyTorch issue noted originally has been resolved. Most of the failures here seem to be related to Distributed's |
Currently, the dask and cuda serialization families overwrite the header of the underlying dumps functions. For instance, the
cuda_dumps
overwrite the"type-serialized"
, which is a problem when Dask usespickle5
and the underlying loads function usepickle protocol=4
.Beside, overwriting an underlying protocol's header is bad style.
This PR fixes this issue
pre-commit run --all-files