Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic detection of number of CPU cores #530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/openwebtext/prepare.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# saves the openwebtext dataset to a binary file for training. following was helpful:
# https://github.com/HazyResearch/flash-attention/blob/main/training/src/datamodules/language_modeling_hf.py

import multiprocessing
import os
from tqdm import tqdm
import numpy as np
Expand All @@ -9,7 +10,7 @@

# number of workers in .map() call
# good number to use is ~order number of cpu cores // 2
num_proc = 8
num_proc = multiprocessing.cpu_count() // 2

# number of workers in load_dataset() call
# best number might be different from num_proc above as it also depends on NW speed.
Expand Down