Datasets:
Upload folder using huggingface_hub
Browse files- data_19b.bin +3 -0
- test.py +45 -0
- val.bin +3 -0
data_19b.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b88ffa322bcbf78c8b143b73e8305294a9cd121dc4f5e06569ae16acc1fb562
|
| 3 |
+
size 40135044184
|
test.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import numpy as np
|
| 3 |
+
import random
|
| 4 |
+
from transformers import GPT2Tokenizer
|
| 5 |
+
|
| 6 |
+
# --- Settings ---
|
| 7 |
+
BIN_PATH = "data_19b.bin"
|
| 8 |
+
NUM_SAMPLES = 10
|
| 9 |
+
SAMPLE_LEN = 200 # Number of tokens to decode per sample
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
if not os.path.exists(BIN_PATH):
|
| 13 |
+
print(f"Error: {BIN_PATH} not found.")
|
| 14 |
+
return
|
| 15 |
+
|
| 16 |
+
# 1. Load the tokenizer
|
| 17 |
+
print("Loading GPT-2 Tokenizer...")
|
| 18 |
+
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
|
| 19 |
+
|
| 20 |
+
# 2. Map the data (instantly points to the 40GB file)
|
| 21 |
+
data = np.memmap(BIN_PATH, dtype=np.uint16, mode='r')
|
| 22 |
+
total_tokens = len(data)
|
| 23 |
+
print(f"File loaded. Total tokens: {total_tokens:,}")
|
| 24 |
+
|
| 25 |
+
# 3. Pick random spots and decode
|
| 26 |
+
print(f"\n--- Decoding {NUM_SAMPLES} Random Samples ---\n")
|
| 27 |
+
|
| 28 |
+
for i in range(NUM_SAMPLES):
|
| 29 |
+
# Pick a random starting index
|
| 30 |
+
start_idx = random.randint(0, total_tokens - SAMPLE_LEN)
|
| 31 |
+
end_idx = start_idx + SAMPLE_LEN
|
| 32 |
+
|
| 33 |
+
# Pull the uint16 tokens and convert to standard Python list
|
| 34 |
+
token_ids = data[start_idx:end_idx].tolist()
|
| 35 |
+
|
| 36 |
+
# Decode to text
|
| 37 |
+
decoded_text = tokenizer.decode(token_ids, skip_special_tokens=True)
|
| 38 |
+
|
| 39 |
+
print(f"Sample {i+1} (Index {start_idx:,}):")
|
| 40 |
+
print("-" * 50)
|
| 41 |
+
print(decoded_text)
|
| 42 |
+
print("-" * 50 + "\n")
|
| 43 |
+
|
| 44 |
+
if __name__ == "__main__":
|
| 45 |
+
main()
|
val.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c2a0206c7a25e384a365d21aee2391715ce4b45d4af9d65b2302fe344289e05
|
| 3 |
+
size 8856490
|