Is uint8 supported?
MEMBER
Hi ! The numpy formatting detaults to int64 and float32 - but you can use uint8 using
```python
ds = ds.with_format("numpy", dtype=np.uint8)
```
2023-05-10T12:25:56Z
https://github.com/huggingface/datasets/issues/5834#issuecomment-1542118387
https://api.github.com/repos/huggingface/datasets/issues/5834
IC_kwDODunzps5b6tvz
https://api.github.com/repos/huggingface/datasets/issues/comments/1542118387/reactions
2023-05-10T12:26:01Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1542118387
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
COLLABORATOR
Related to https://github.com/huggingface/datasets/issues/5517.
2023-05-10T14:40:49Z
https://github.com/huggingface/datasets/issues/5834#issuecomment-1542325793
https://api.github.com/repos/huggingface/datasets/issues/5834
IC_kwDODunzps5b7gYh
https://api.github.com/repos/huggingface/datasets/issues/comments/1542325793/reactions
2023-05-10T14:40:49Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1542325793
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
Thank you!
By setting `ds.with_format("numpy", dtype=np.uint8)`, the dataset returns the data in `uint8`.

However, `with_format` and `set_format` seem to cast the data on-the-fly.
I want to reduce the dataset size by using `uint8` instead of `int64` and I observe no difference between using `int64` and `uint8` for the vector.
Is there any way to actually store the data in `uint8` and save the disk space and the downloading time when loaded from the hub?

2023-05-12T13:07:07Z
https://github.com/huggingface/datasets/issues/5834#issuecomment-1545718745
https://api.github.com/repos/huggingface/datasets/issues/5834
IC_kwDODunzps5cIcvZ
https://api.github.com/repos/huggingface/datasets/issues/comments/1545718745/reactions
2023-05-12T13:16:06Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1545718745
https://avatars.githubusercontent.com/u/17979572?v=4
https://api.github.com/users/ryokan0123/events{/privacy}
https://api.github.com/users/ryokan0123/followers
https://api.github.com/users/ryokan0123/following{/other_user}
https://api.github.com/users/ryokan0123/gists{/gist_id}
https://github.com/ryokan0123
ryokan0123
MDQ6VXNlcjE3OTc5NTcy
https://api.github.com/users/ryokan0123/orgs
https://api.github.com/users/ryokan0123/received_events
https://api.github.com/users/ryokan0123/repos
https://api.github.com/users/ryokan0123/starred{/owner}{/repo}
https://api.github.com/users/ryokan0123/subscriptions
User
https://api.github.com/users/ryokan0123
public
MEMBER
If the feature type is `Value("uint8")` then it's written an uint8 on disk using the uint8 Arrow dtype.

e.g.
```python
ds = Dataset.from_dict({"a": range(10)}, features=Features({"a": Value("uint8")}))
ds.data.nbytes
# 10
```
2023-05-12T13:18:08Z
https://github.com/huggingface/datasets/issues/5834#issuecomment-1545733623
https://api.github.com/repos/huggingface/datasets/issues/5834
IC_kwDODunzps5cIgX3
https://api.github.com/repos/huggingface/datasets/issues/comments/1545733623/reactions
2023-05-12T13:18:08Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1545733623
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
NONE
Oh, I understand now.
The data was stored in `uint8` from the beginning (when the dataset returns `int64`).

Thank you for your time!
My question is fully resolved.
2023-05-13T05:04:21Z
https://github.com/huggingface/datasets/issues/5834#issuecomment-1546529090
https://api.github.com/repos/huggingface/datasets/issues/5834
IC_kwDODunzps5cLilC
https://api.github.com/repos/huggingface/datasets/issues/comments/1546529090/reactions
2023-05-13T05:04:21Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1546529090
https://avatars.githubusercontent.com/u/17979572?v=4
https://api.github.com/users/ryokan0123/events{/privacy}
https://api.github.com/users/ryokan0123/followers
https://api.github.com/users/ryokan0123/following{/other_user}
https://api.github.com/users/ryokan0123/gists{/gist_id}
https://github.com/ryokan0123
ryokan0123
MDQ6VXNlcjE3OTc5NTcy
https://api.github.com/users/ryokan0123/orgs
https://api.github.com/users/ryokan0123/received_events
https://api.github.com/users/ryokan0123/repos
https://api.github.com/users/ryokan0123/starred{/owner}{/repo}
https://api.github.com/users/ryokan0123/subscriptions
User
https://api.github.com/users/ryokan0123
public
### Describe the bug

I expect the dataset to store the data in the `uint8` data type, but it's returning `int64` instead.
While I've found that `datasets` doesn't yet support float16 (https://github.com/huggingface/datasets/issues/4981), I'm wondering if this is the case for other data types as well.
Is there a way to store vector data as `uint8` and then upload it to the hub?

### Steps to reproduce the bug

```python
from datasets import Features, Dataset, Sequence, Value
import numpy as np

dataset = Dataset.from_dict(
    {"vector": [np.array([0, 1, 2], dtype=np.uint8)]}, features=Features({"vector": Sequence(Value("uint8"))})
).with_format("numpy")

print(dataset[0]["vector"].dtype)
```

### Expected behavior

Expected: `uint8`
Actual: `int64`

### Environment info

- `datasets` version: 2.12.0
- Platform: macOS-12.1-x86_64-i386-64bit
- Python version: 3.8.12
- Huggingface_hub version: 0.12.1
- PyArrow version: 11.0.0
- Pandas version: 1.5.3