-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent-step.sh
executable file
·76 lines (73 loc) · 1.83 KB
/
agent-step.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
#!/bin/sh
MODEL="llama3.2" # llama3.2, qwen2:7b, gemma:7b, tinyllama, mixtral, etc.
ROUND=0
if [ -f round ]; then
ROUND=`cat round`
fi
ID=0
if [ -f id ]; then
ID=`cat id`
fi
# ------------------------------------------------------------------------------------------------------------
# Kickstart
# ------------------------------------------------------------------------------------------------------------
if [ $ROUND -eq 0 ]; then
if [ $ID -eq 101 ]; then
echo "Initialization Complete."
echo "Initiating evolution."
ROUND=1
ID=1
echo $ID >id
echo $ROUND >round
else
./init-agent.sh $ID $MODEL
fi
fi
# ------------------------------------------------------------------------------------------------------------
# Normal Processing
# ------------------------------------------------------------------------------------------------------------
if [ ! -f "/etc/exollama/pod.id" ]; then
echo "Error: You need to run install.sh first."
exit 1
fi
EXOLLAMA_ROOT="../.."
if [ -d "/usr/local/exollama" ]; then
EXOLLAMA_ROOT="/usr/local/exollama"
fi
POD=`$EXOLLAMA_ROOT/pod-name.sh`
./pod-status.sh
if [ -f .exosync ]; then
ELAPSED=`stat -c %Y .exosync`
ELAPSED=$(($EPOCHSECONDS - $ELAPSED))
ELAPSED=$(($ELAPSED/3600))
if [ $ELAPSED -gt 0 ]; then
git pull
touch .exosync
fi
fi
./roster.sh >$POD.roster
PROCESSED=0
NAME=""
while [ $PROCESSED -eq 0 ]; do
NAME=`./agent-name.sh $ID`
POD_CHECK=`grep -c "$NAME" "$POD.roster"`
if [ $POD_CHECK -eq 1 ]; then
./maybe-think.sh $ID
if [ $? -eq 0 ]; then
PROCESSED=1
echo "$NAME Update for $POD - Round $ROUND" >.exo-commit
else
ID=$(($ID+1))
fi
else
ID=$(($ID+1))
fi
if [ $ID -eq 101 ]; then PROCESSED=1; fi
done
if [ $ID -eq 101 ]; then
echo "Agent Processing Finished."
./round-status.sh
fi
git diff
git add .
git status