@@ -74,7 +74,7 @@ def sudo_set_hyperparameter_values(
74
74
return response .is_success
75
75
76
76
77
- async def wait_epoch (subtensor : "Subtensor" , netuid : int = 1 , times : int = 1 ):
77
+ async def wait_epoch (subtensor : "Subtensor" , netuid : int = 1 , ** kwargs ):
78
78
"""
79
79
Waits for the next epoch to start on a specific subnet.
80
80
@@ -90,7 +90,7 @@ async def wait_epoch(subtensor: "Subtensor", netuid: int = 1, times: int = 1):
90
90
raise Exception ("could not determine tempo" )
91
91
tempo = q_tempo [0 ].value
92
92
logging .info (f"tempo = { tempo } " )
93
- await wait_interval (tempo * times , subtensor , netuid )
93
+ await wait_interval (tempo , subtensor , netuid , ** kwargs )
94
94
95
95
96
96
def next_tempo (current_block : int , tempo : int , netuid : int ) -> int :
@@ -105,6 +105,7 @@ def next_tempo(current_block: int, tempo: int, netuid: int) -> int:
105
105
Returns:
106
106
int: The next tempo block number.
107
107
"""
108
+ current_block += 1
108
109
interval = tempo + 1
109
110
last_epoch = current_block - 1 - (current_block + netuid + 1 ) % interval
110
111
next_tempo_ = last_epoch + interval
@@ -117,6 +118,7 @@ async def wait_interval(
117
118
netuid : int = 1 ,
118
119
reporting_interval : int = 1 ,
119
120
sleep : float = 0.25 ,
121
+ times : int = 1 ,
120
122
):
121
123
"""
122
124
Waits until the next tempo interval starts for a specific subnet.
@@ -126,7 +128,11 @@ async def wait_interval(
126
128
the current block number until the next tempo interval starts.
127
129
"""
128
130
current_block = subtensor .get_current_block ()
129
- next_tempo_block_start = next_tempo (current_block , tempo , netuid )
131
+ next_tempo_block_start = current_block
132
+
133
+ for _ in range (times ):
134
+ next_tempo_block_start = next_tempo (next_tempo_block_start , tempo , netuid )
135
+
130
136
last_reported = None
131
137
132
138
while current_block < next_tempo_block_start :
0 commit comments