forked from flexflow/flexflow-train
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrename.sh
81 lines (66 loc) · 1.67 KB
/
rename.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# Target directory
TARGET_DIR="/root/.cache/flexflow/weights/m4-ai/tinymistral-6x248m/full-precision"
# Loop through files containing "layer_"
for file in "$TARGET_DIR"/*layer_*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//layer_/layer.}"
fi
done
# Loop through files containing "_input"
for file in "$TARGET_DIR"/*_input*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//_input/.input}"
fi
done
# Loop through files containing ".mlp."
for file in "$TARGET_DIR"/*_mlp_*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//.mlp./.mlp.}"
fi
done
for file in "$TARGET_DIR"/*_post*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//_post/.post}"
fi
done
for file in "$TARGET_DIR"/*_block*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//_block/.block}"
fi
done
for file in "$TARGET_DIR"/*layers_*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//layers_/layers.}"
fi
done
for file in "$TARGET_DIR"/*proj_*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//proj_/proj.}"
fi
done
for file in "$TARGET_DIR"/*_self*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//_self/.self}"
fi
done
for file in "$TARGET_DIR"/*attn_*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//attn_/attn.}"
fi
done
for file in "$TARGET_DIR"/*embed_tokens_weight*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//embed_tokens_weight/embed_tokens.weight}"
fi
done
for file in "$TARGET_DIR"/*layernorm_weight*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//layernorm_weight/layernorm.weight}"
fi
done
for file in "$TARGET_DIR"/*_weight*; do
if [[ -f "$file" ]]; then
mv "$file" "${file//_weight/.weight}"
fi
done