feat: 并行 batch tokenization + cache_jsonl 批处理支持
- pipeline/tokenize/tokenizer.py: encode() 全部走 encode_batch(支持单条/批量) - pipeline/processors/base.py: BaseProcessor 新增 process_batch() - pipeline/processors/pretrain.py: PreTrainProcessor 覆盖 process_batch() 批量编码 - pipeline/io/export.py: cache_jsonl 新增 batch_size 参数默认 1000, 批量处理 - scripts/cache_h5.py: 新增 --batch-size 参数, 默认 tokenizer 路径改为 ../AstrAI/params
This commit is contained in:
@@ -72,6 +72,12 @@ def main():
|
||||
choices=["DEBUG", "INFO", "WARNING", "ERROR"],
|
||||
help="Logging level (default: INFO)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--batch-size",
|
||||
type=int,
|
||||
default=1000,
|
||||
help="Lines per batch for parallel tokenization via encode_batch (default: 1000)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-f",
|
||||
"--output-format",
|
||||
@@ -133,6 +139,7 @@ def main():
|
||||
group_size=args.group_size,
|
||||
pack_algo=args.pack_algo,
|
||||
output_format=args.output_format,
|
||||
batch_size=args.batch_size,
|
||||
)
|
||||
print(f"\nDone! Output saved to {output_dir}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user