Discussion about dataset preparation speed

Đang mở
#202 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
15/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
data, performance

Hướng nghiên cứu

The reproduction script calls GPTMemmapDataset and get_document_sizes from the fast_llm.data.dataset.gpt.memmap module, so start there and compare what the dataset preparation path does beyond reading document sizes. Profile a run over a few bin files to find where the 6.5 minutes go, since the issue's own baseline is about 13 seconds. Done means a measured explanation of the gap or a concrete change with timings, agreed with maintainers first.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement need update

🎯 Description

With 1,250 bin files, dataset preparation takes around 6.5 minutes on 100 cores, 1TB RAM, and 8 GPUs.

However, if I simply iterate through these files, read document sizes, and write them to another file to simulate basic indexing, it takes only about 13 seconds on 12 processes (to match the scenario above, with 100/8 processes per GPU).

from fast_llm.data.dataset.gpt.memmap import GPTMemmapDataset
import numpy as np
import time

import yaml
import multiprocessing as mp


def count_tokens_save_doc_sizes(file, out_file):
    ds = GPTMemmapDataset("ds", file)
    sizes = ds.get_document_sizes().astype(np.int64)
    sizes.tofile(out_file)
    return np.sum(sizes)


if __name__ == "__main__":
    with open("/mnt/datasets/test/denis/fineweb_the_stack_3b.yaml", "rt") as f:
        data = yaml.safe_load(f)

    files = [el["path"] for el in data["datasets"][0]["datasets"]] + [
        el["path"] for el in data["datasets"][1]["datasets"]
    ]

    t0 = time.time()

    with mp.Pool(processes=12) as pool:
        ttl = sum(
            pool.starmap(
                count_tokens_save_doc_sizes,
                [(file, f"/mnt/datasets/test/denis/{i}.np") for i, file in enumerate(files)],
            )
        )

    print(f"time {time.time()-t0}")

    print(len(files), ttl)

So, I wonder—can we further increase the dataset preparation speed?

Ngôn ngữ chính
Python
Star
337
Fork
52
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ServiceNow/Fast-LLM

Tất cả issue của ServiceNow/Fast-LLM

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.