#!/bin/bash # 指定要遍历的目录 directory=$1 # 指定输出文件 output_file=$2 # 删除旧的输出文件,如果存在的话 rm -f "$output_file" # 遍历指定目录下的所有文件 for file in "$directory"/*; do # 检查文件是否是普通文件 if [ -f "$file" ]; then # 将文件内容追加到输出文件中 python3 tools/preprocess_data.py --input $file --output-prefix $output_file-$(basename $file) --tokenizer-model Meta-Llama-3-8B/tokenizer.model --tokenizer-type Llama3Tokenizer --append-eod --workers 64 # 添加一个换行符,以保持jsonl格式 echo "finished $output_file-$(basename $file)" fi done