Spaces:
Sleeping
Sleeping
File size: 446 Bytes
54ad1e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import os
from tokenizer import train_sentencepiece
from config import vocab_size
DATA_DIR = "./training_data"
text_files = [
os.path.join(DATA_DIR, f)
for f in os.listdir(DATA_DIR)
if f.endswith(".txt")
]
print(f"Found {len(text_files)} text files")
if not text_files:
raise ValueError(
f"No .txt files found in {DATA_DIR}"
)
tokenizer = train_sentencepiece(text_files,vocab_size=vocab_size)
|