forked from macrocosm-os/prompting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
105 lines (100 loc) · 2.65 KB
/
run.py
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import subprocess
coldkey = "sn1-test"
netuid = 61
network = "test"
miners = [
# Mock (static)
{
"hotkey": "m1",
"port": 9001,
"file": "neurons/miners/test/mock.py",
"type": "mock",
},
{
"hotkey": "m2",
"port": 9002,
"file": "neurons/miners/test/mock.py",
"type": "mock",
},
# Echo
{
"hotkey": "m3",
"port": 9003,
"file": "neurons/miners/test/echo.py",
"type": "echo",
},
{
"hotkey": "m4",
"port": 9004,
"file": "neurons/miners/test/echo.py",
"type": "echo",
},
{
"hotkey": "m5",
"port": 9005,
"file": "neurons/miners/test/echo.py",
"type": "echo",
},
# Phrase
{
"hotkey": "m6",
"port": 9006,
"file": "neurons/miners/test/phrase.py",
"type": "phrase",
"config": '--neuron.phrase "That is an excellent question"',
},
{
"hotkey": "m7",
"port": 9007,
"file": "neurons/miners/test/phrase.py",
"type": "phrase",
"config": '--neuron.phrase "Could you repeat that?"',
},
{
"hotkey": "m8",
"port": 9008,
"file": "neurons/miners/test/phrase.py",
"type": "phrase",
"config": '--neuron.phrase "And so it goes..."',
},
{
"hotkey": "m9",
"port": 9009,
"file": "neurons/miners/test/phrase.py",
"type": "phrase",
"config": '--neuron.phrase "You and me baby ain\'t nothing but mammals"',
},
{
"hotkey": "m10",
"port": 9010,
"file": "neurons/miners/test/phrase.py",
"type": "phrase",
"config": "--neuron.phrase \"I'm sorry Dave, I'm afraid I can't do that\"",
},
]
validators = [
{
"hotkey": "v1",
"port": 9000,
"file": "neurons/validator.py",
"type": "real",
"config": "--neuron.log_full --neuron.sample_size 5 --neuron.device cuda",
},
{
"hotkey": "v2",
"port": 9011,
"file": "neurons/validator.py",
"type": "mock",
"config": "--neuron.log_full --neuron.sample_size 5 --neuron.model_id mock",
},
]
neurons = miners + validators
for neuron in neurons:
# Construct the PM2 start command
command = (
f"pm2 start {neuron['file']} --interpreter python3 --name {neuron['hotkey']}:{neuron['type']} --"
+ f" --wallet.name {coldkey} --wallet.hotkey {neuron['hotkey']} --subtensor.network {network} --netuid {netuid}"
+ f" --axon.port {neuron['port']} --logging.debug {neuron.get('config')}"
)
print(command)
subprocess.run(command, shell=True)