mattb512 commited on
Commit
e5c817a
1 Parent(s): d9d5028

add shell function

Browse files
Files changed (1) hide show
  1. startup.sh +49 -12
startup.sh CHANGED
@@ -13,14 +13,34 @@ python3 -c "import torch; \
13
  print(f\"device count = {torch.cuda.device_count()}\"); \
14
  print(f\"current device = {torch.cuda.current_device()}\")"
15
 
16
-
17
- echo "Starting serve.controller"
18
- nohup python3 -m serve.controller --host 0.0.0.0 --port 10000 2>&1 | tee serve.controller.log &
19
- while [ `grep -c "Uvicorn running on" serve.controller.log` -eq '0' ];do
20
- sleep 1s;
21
- echo "wait server running"
22
- done
23
- echo "serve.controller is running"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
 
26
  # sleep 30
@@ -29,11 +49,28 @@ echo "serve.controller is running"
29
  # python3 -m interactive_demo --port 40000 --model_id prism-dinosiglip+13b &
30
  # P4=$!
31
 
32
- sleep 31
33
 
34
- echo "Starting prism-dinosiglip+7b"
35
- python3 -m interactive_demo --port 40000 --model_id prism-dinosiglip+7b &
36
- P_P7B=$!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  # python3 -m interactive_demo --port 40002 --model_id prism-dinosiglip-controlled+7b &
39
  # P6=$!
 
13
  print(f\"device count = {torch.cuda.device_count()}\"); \
14
  print(f\"current device = {torch.cuda.current_device()}\")"
15
 
16
+ RUN_AND_WAIT() {
17
+ # 1st param: the script name, eg "server.controller"
18
+ # 2nd param: the command to execute
19
+ # 3rd param: the log entry to watch for that indicate the component is ready
20
+ COMPONENT=$1
21
+ echo "Starting $COMPONENT"
22
+ nohup eval $2 2>&1 | tee "$COMPONENT.log" &
23
+ while [ `grep -c $3 "$COMPONENT.log"` -eq '0' ];do
24
+ sleep 1s;
25
+ echo "wait $COMPONENT to be running"
26
+ done
27
+ echo "$COMPONENT is running"
28
+ }
29
+
30
+ COMPONENT="serve.controller"
31
+ COMMAND=python3 -m $COMPONENT --host 0.0.0.0 --port 10000
32
+ READY_LOG="Uvicorn running on"
33
+
34
+ RUN_AND_WAIT $COMPONENT $COMMAND $READY_LOG
35
+
36
+ # COMPONENT="serve.controller"
37
+ # echo "Starting $COMPONENT"
38
+ # nohup python3 -m $COMPONENT --host 0.0.0.0 --port 10000 2>&1 | tee "$COMPONENT.log" &
39
+ # while [ `grep -c "Uvicorn running on" "$COMPONENT.log"` -eq '0' ];do
40
+ # sleep 1s;
41
+ # echo "wait $COMPONENT to be running"
42
+ # done
43
+ # echo "$COMPONENT is running"
44
 
45
 
46
  # sleep 30
 
49
  # python3 -m interactive_demo --port 40000 --model_id prism-dinosiglip+13b &
50
  # P4=$!
51
 
 
52
 
53
+
54
+ # echo "Starting prism-dinosiglip+7b"
55
+ # python3 -m interactive_demo --port 40000 --model_id prism-dinosiglip+7b &
56
+
57
+ COMPONENT="interactive_demo"
58
+ COMMAND=python3 -m $COMPONENT --port 40000 --model_id prism-dinosiglip+7
59
+ READY_LOG="loaded prismatic prism-dinosiglip+7b"
60
+
61
+ RUN_AND_WAIT $COMPONENT $COMMAND $READY_LOG
62
+
63
+
64
+ # echo "Starting $COMPONENT"
65
+ # nohup | tee "$COMPONENT.log" &
66
+ # while [ `grep -c "loaded prismatic prism-dinosiglip+7b" "$COMPONENT.log"` -eq '0' ];do
67
+ # sleep 1s;
68
+ # echo "wait $COMPONENT to be running"
69
+ # done
70
+ # echo "$COMPONENT is running"
71
+
72
+
73
+
74
 
75
  # python3 -m interactive_demo --port 40002 --model_id prism-dinosiglip-controlled+7b &
76
  # P6=$!