llava-pretrain-vi / README.md
Duy1332002's picture
Update README.md
140f1b5 verified
metadata
license: mit
language:
  - vi
size_categories:
  - 100K<n<1M

Structure

Each sample will have a structure as follows:

{
  'id': Value(dtype='string', id=None),
  'images': Value(dtype='binary', id=None),
  'conversations': [{'from': Value(dtype='string', id=None), 'value': Value(dtype='string', id=None)}]
}

{
  'id': '004309348',
  'image': <image-bytes>,
  '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á'}]
}

How To Use

Convert binary objects

Because the returned video will be in bytes, here is a way to extract frames and fps:

import io
import numpy as np    
from PIL import Image
from datasets import load_dataset

def extract_image(image_bytes):
    img = Image.open(io.BytesIO(image_bytes))
    arr = np.asarray(img)
    return arr

dataset = load_dataset("Vividbot/instruct500k_vi", name="all", streaming=True)

image_bytes = next(iter(dataset["train"]))["image"]
image = extract_image(image_bytes)
print(f"Image shape: {image.shape}")