File size: 1,310 Bytes
9f61031
 
 
 
 
e455f85
9f61031
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e455f85
9f61031
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash

current_path=$(pwd)

# Find the path containing PFLlib, excluding hidden directories
pfllib_parent=$(find "$current_path" -type d -name "PFLlib" -not -path '*/\.*' | head -n 1 | xargs dirname)

if [ -z "$pfllib_parent" ]; then
    echo "Error: PFLlib directory not found in $HOME"
    exit 1
fi

change_path="$pfllib_parent/PFLlib/system"

if [ "$current_path" != "$change_path" ]; then
    if [ -d "$change_path" ]; then
        cd "$change_path"
        echo "Changed to: $(pwd)"
    else
        echo "Error: $change_path does not exist"
        exit 1
    fi
else
    echo "Already in the correct directory"
fi


python main.py --dataset $1 \
               --model cnn \
               --algorithm FedProx \
               --global_rounds 200 \
               --device_id 0 \
               --num_classes 10 \
               --num_clients 50 \
               --device cuda \
               --goal train \
               --batch_size 20 \
               --local_epochs 10 \
               --local_learning_rate 0.05 \
               --join_ratio $2 \
               --learning_rate_decay True \
               --learning_rate_decay_gamma 0.99 \
               --client_drop_rate $3 \
               --mu $4


echo "Change back to the previous directory: $current_path"
cd $current_path