-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit_embeddings.sh
More file actions
executable file
·62 lines (51 loc) · 2.04 KB
/
Copy pathsplit_embeddings.sh
File metadata and controls
executable file
·62 lines (51 loc) · 2.04 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Split large files into chunks under 100MB for Git
echo "=================================================="
echo "Splitting Large Files into Git-Friendly Chunks"
echo "=================================================="
echo ""
CHUNK_SIZE="95M" # 95MB per chunk (safely under 100MB limit)
# Create chunks directory
mkdir -p embeddings_chunks
# Split embeddings.npy (808 MB -> ~9 chunks)
if [ -f "embeddings.npy" ]; then
echo "Splitting embeddings.npy..."
split -b $CHUNK_SIZE embeddings.npy embeddings_chunks/embeddings.npy.part_
echo "✓ Created $(ls embeddings_chunks/embeddings.npy.part_* | wc -l) chunks"
# Create checksum
shasum -a 256 embeddings.npy > embeddings_chunks/embeddings.npy.sha256
echo "✓ Created checksum"
else
echo "⚠️ embeddings.npy not found"
fi
echo ""
# Split unified_media_database.json (442 MB -> ~5 chunks)
if [ -f "unified_media_database.json" ]; then
echo "Splitting unified_media_database.json..."
split -b $CHUNK_SIZE unified_media_database.json embeddings_chunks/database.json.part_
echo "✓ Created $(ls embeddings_chunks/database.json.part_* | wc -l) chunks"
# Create checksum
shasum -a 256 unified_media_database.json > embeddings_chunks/database.json.sha256
echo "✓ Created checksum"
else
echo "⚠️ unified_media_database.json not found"
fi
echo ""
# Note: embeddings_index.json (7.3 MB) stays at root level
# It's small enough to commit directly to git (no chunking needed)
echo "✓ embeddings_index.json (7.3 MB) - committed directly to git (no chunking needed)"
echo ""
# Show results
echo "=================================================="
echo "✓ Splitting Complete!"
echo "=================================================="
echo ""
echo "Chunk directory: embeddings_chunks/"
ls -lh embeddings_chunks/ | tail -n +2
echo ""
echo "Next steps:"
echo " 1. git add embeddings_chunks/ embeddings_index.json"
echo " 2. git commit -m 'Add embeddings in chunks'"
echo ""
echo "Note: embeddings_index.json is committed at root (not chunked)"
echo ""