File size: 1,152 Bytes
ba431fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6aa6f83
f51cd13
ba431fb
 
 
 
 
 
 
6aa6f83
 
ba431fb
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

# Get the current script directory of the script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# lm-eval-output dir
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
BASE_DIR="$PROJECT_DIR/lm-eval-output"

echo "==================================================="
echo "Compressing all jsonl files in $BASE_DIR"
echo "==================================================="

# Find all directories containing .jsonl files, without duplicates
find "$BASE_DIR" -type f -name '*.jsonl' | awk -F/ 'BEGIN{OFS="/"}{$NF=""; print $0}' | xargs -I {} readlink -f {} | sort -u | while read -r DIR
do
    # Process each directory
    bash "$SCRIPT_DIR/build-jsonl-archive-in-folder.sh" "$DIR" &
    # sleep 1
done

# Sleep for 5 second to allow the background processes to start
sleep 5

# Wait for all background processes to finish
wait
wait
wait

# Sleep for 1 second to allow the background processes to finish / echo logs to flush, etc
sleep 1

# Done
echo "==================================================="
echo "All jsonl files in $BASE_DIR have been compressed"
echo "==================================================="