This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmanual_weight_set.py
43 lines (36 loc) · 1.53 KB
/
manual_weight_set.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
"""
This is a utility script for manually setting weights in the case of any issues
Use cases:
- Testing weight setting to see scores and help debug
- Emergencies if weight setting in the vali is facing issues - but the proxy is still working as expected [not recommended]
NOTE: this is not artificial weights / weight copying, it uses real values obtained by the validator proxy only.
It's just taking that part of the code, and making it independently runnable
Usage:
python manually_set_weights.py --env_file {youvr_vali_hotkey_env_file_here}
"""
from validation.core_validator import core_validator
from validation.weight_setting import calculations
import asyncio
from validation.db.db_management import db_manager
async def main():
await core_validator.resync_metagraph()
await db_manager.initialize()
total_scores = await calculations.calculate_scores_for_settings_weights(
capacities_for_tasks=core_validator.capacities_for_tasks,
uid_to_uid_info=core_validator.uid_to_uid_info,
task_weights=core_validator.task_weights,
)
weights, uids = core_validator.weight_setter._get_processed_weights_and_uids(
uid_to_uid_info=core_validator.uid_to_uid_info,
metagraph=core_validator.metagraph,
total_hotkey_scores=total_scores,
netuid=19,
)
core_validator.weight_setter._set_weights(
wallet=core_validator.wallet,
netuid=19,
processed_weight_uids=uids,
processed_weights=weights,
)
if __name__ == "__main__":
result = asyncio.run(main())