修复输出文件的bug
This commit is contained in:
@@ -3,6 +3,7 @@ __pycache__*
|
|||||||
|
|
||||||
# dataset
|
# dataset
|
||||||
dataset/*
|
dataset/*
|
||||||
|
pkl_output/*
|
||||||
|
|
||||||
# tokenzier
|
# tokenzier
|
||||||
tokenizer.json
|
tokenizer.json
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def convert_to_ids(tokenizer: BpeTokenizer, file_path, out_file_path):
|
|||||||
arrow = torch.tensor(ids, dtype=torch.int32)
|
arrow = torch.tensor(ids, dtype=torch.int32)
|
||||||
arrows.append(arrow)
|
arrows.append(arrow)
|
||||||
|
|
||||||
with open(out_file_path, "w") as f:
|
with open(out_file_path, "wb") as f:
|
||||||
tensor = torch.cat(arrows)
|
tensor = torch.cat(arrows)
|
||||||
pkl.dump(tensor, f)
|
pkl.dump(tensor, f)
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ if __name__ == "__main__":
|
|||||||
os.path.join("dataset", "chinese-c4"),
|
os.path.join("dataset", "chinese-c4"),
|
||||||
os.path.join("dataset", "english-fineweb")
|
os.path.join("dataset", "english-fineweb")
|
||||||
]
|
]
|
||||||
base_out_dir = "cache"
|
base_out_dir = "pkl_output"
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
for dir_path in base_dir:
|
for dir_path in base_dir:
|
||||||
|
|||||||
Reference in New Issue
Block a user