forked from LHXXHB/PseudoCal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrect_filepaths.sh
executable file
·52 lines (45 loc) · 1.51 KB
/
correct_filepaths.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
#!/usr/bin/env bash
set -e
FOLDER=$1
# Compute the absolute path to the OfficeHome dataset.
if [ -d "data/$FOLDER" ]; then
OH_PATH="$(cd data/$FOLDER && pwd)"
else
echo "Error: Directory data/$FOLDER not found." >&2
exit 1
fi
echo "Using OfficeHome dataset at: ${OH_PATH}"
# --- Update files in the data folder ---
if [ -d "data/office-home" ]; then
pushd data/office-home > /dev/null
# Replace "xxxxxx/office_home" with local absolute path in all .txt files.
sed -i.bak "s|xxxxxx/office_home|${OH_PATH}|g" *.txt
rm -f *.bak
popd > /dev/null
else
echo "Directory data/office-home not found!" >&2
exit 1
fi
# --- Update PDA log files ---
if [ -d "logs/pda/train/22/PADA/office-home/AC" ]; then
pushd logs/pda/train/22/PADA/office-home/AC > /dev/null
# Replace the old path with local absolute path in src_*.txt files.
sed -i.bak "s|/Checkpoint/liangjian/da_dataset/office_home|${OH_PATH}|g" src_*.txt
rm -f *.bak
popd > /dev/null
else
echo "Directory logs/pda/train/22/PADA/office-home/AC not found!" >&2
exit 1
fi
# --- Update UDA log files ---
if [ -d "logs/uda/train/22/bnm/office-home/AC" ]; then
pushd logs/uda/train/22/bnm/office-home/AC > /dev/null
# Replace the old path with local absolute path in src_*.txt files.
sed -i.bak "s|/Checkpoint/liangjian/da_dataset/office_home|${OH_PATH}|g" src_*.txt
rm -f *.bak
popd > /dev/null
else
echo "Directory logs/uda/train/22/bnm/office-home/AC not found!" >&2
exit 1
fi
echo "All files have been updated with the new OfficeHome dataset path."