Duy1332002
commited on
Commit
•
db91132
1
Parent(s):
6e43b26
Update README.md
Browse files
README.md
CHANGED
@@ -4,4 +4,43 @@ language:
|
|
4 |
- vi
|
5 |
size_categories:
|
6 |
- 100K<n<1M
|
7 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
- vi
|
5 |
size_categories:
|
6 |
- 100K<n<1M
|
7 |
+
---
|
8 |
+
|
9 |
+
|
10 |
+
# Structure
|
11 |
+
Each sample will have a structure as follows:
|
12 |
+
```
|
13 |
+
{
|
14 |
+
'id': Value(dtype='string', id=None),
|
15 |
+
'images': Value(dtype='binary', id=None),
|
16 |
+
'conversations': [{'from': Value(dtype='string', id=None), 'value': Value(dtype='string', id=None)}]
|
17 |
+
}
|
18 |
+
|
19 |
+
{
|
20 |
+
'id': '004309348',
|
21 |
+
'image': <image-bytes>,
|
22 |
+
'conversations': [{'from': 'human', 'value': 'Điều gì được minh họa trong hình ảnh này?\n<image>'}, {'from': 'gpt', 'value': 'bạn nghĩ có bao nhiêu sinh viên ở farbaut sử dụng sản phẩm thuốc lá'}]
|
23 |
+
}
|
24 |
+
```
|
25 |
+
|
26 |
+
# How To Use
|
27 |
+
|
28 |
+
## Convert binary objects
|
29 |
+
Because the returned video will be in bytes, here is a way to extract frames and fps:
|
30 |
+
```python
|
31 |
+
import io
|
32 |
+
import numpy as np
|
33 |
+
from PIL import Image
|
34 |
+
from datasets import load_dataset
|
35 |
+
|
36 |
+
def extract_image(image_bytes):
|
37 |
+
img = Image.open(io.BytesIO(image_bytes))
|
38 |
+
arr = np.asarray(img)
|
39 |
+
return arr
|
40 |
+
|
41 |
+
dataset = load_dataset("Vividbot/instruct500k_vi", name="all", streaming=True)
|
42 |
+
|
43 |
+
image_bytes = next(iter(dataset))["image"]
|
44 |
+
image = extract_image(image_bytes)
|
45 |
+
print(f"Image shape: {image.shape}")
|
46 |
+
```
|