dask / dask/distributed

Default "dask" (de-serialization) protocol fails to preserve type.

Open
#6,569 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

I'm using Dask 2022.1.0 on Python 3.8.13.

The "dask" serialization protocol has trouble preserving types. The following snippet uses the [Pennylane](https://pennylane.ai/) package:
```
from dask.distributed.protocol import serialize, deserialize
import pennylane as qml
import pennylane.numpy as np

res = qml.numpy.random.uniform(0,2*np.pi,(2,1),requires_grad=True)
res1 = deserialize(*serialize(res))
print(type(res1))
```
```

```

The problem seems to lie in the deserializer:
```
print(serialize(res))
```
```
({'sub-header': {'dtype': (0, '])
```

The "pickle" protocol works:
```
from dask.distributed.protocol import serialize, deserialize
import pennylane as qml
import pennylane.numpy as np

res = qml.numpy.random.uniform(0,2*np.pi,(2,1),requires_grad=True)
res1 = deserialize(*serialize(res, serializers=["pickle"]))
print(type(res1))
```
```

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.