root commited on
Commit
0fe8403
Β·
1 Parent(s): 024e59d

update protocol

Browse files
neurons/validator.py CHANGED
@@ -102,7 +102,8 @@ class Validator(base.BaseValidator):
102
  logger.info("βœ… Scheduler is ready! Proceeding with synthetic requests.")
103
 
104
  async def start_synthetic_epoch(self):
105
- await self.wait_for_scheduler_ready()
 
106
 
107
  logger.info("βœ…βœ…βœ…βœ…βœ… Starting synthetic forward βœ…βœ…βœ…βœ…βœ…")
108
  epoch_start_time = time.time()
@@ -110,7 +111,8 @@ class Validator(base.BaseValidator):
110
  miner_uids = self.filter_miners()
111
  logger.debug(f"Initialized {len(miner_uids)} subnet neurons of total {len(self.metagraph.S)} neurons")
112
 
113
- uids = self.miner_manager.consume(miner_uids)
 
114
 
115
  logger.info(f"Filtered UIDs after consumption: {uids}")
116
 
@@ -137,7 +139,7 @@ class Validator(base.BaseValidator):
137
  for i, response in enumerate(task_warrant_responses):
138
  uid = random_uids[i]
139
  axon = axons[i]
140
-
141
  if response.warrant_task == TaskType.UPSCALING:
142
  upscaling_miners.append((axon, uid))
143
  elif response.warrant_task == TaskType.COMPRESSION:
@@ -263,7 +265,7 @@ class Validator(base.BaseValidator):
263
 
264
  logger.debug(f"Processing upscaling UIDs in batch: {uids}")
265
  forward_tasks = [
266
- self.dendrite.forward(axons=[axon], synapse=synapse, timeout=40)
267
  for axon, synapse in zip(axons, synapses)
268
  ]
269
 
@@ -283,7 +285,7 @@ class Validator(base.BaseValidator):
283
 
284
  batch_processed_time = time.time() - batch_start_time
285
 
286
- sleep_time = 300 - batch_processed_time
287
  logger.info(f"Completed upscaling batch within {batch_processed_time:.2f} seconds")
288
  logger.info(f"Sleeping for {sleep_time:.2f} seconds before next upscaling batch")
289
 
@@ -322,7 +324,7 @@ class Validator(base.BaseValidator):
322
 
323
  logger.debug(f"Processing compression UIDs in batch: {uids}")
324
  forward_tasks = [
325
- self.dendrite.forward(axons=[axon], synapse=synapse, timeout=40)
326
  for axon, synapse in zip(axons, synapses)
327
  ]
328
 
@@ -341,7 +343,7 @@ class Validator(base.BaseValidator):
341
  asyncio.create_task(self.score_compressions(uids, responses, payload_urls, reference_video_paths, timestamp, video_ids, uploaded_object_names, vmaf_threshold, round_id))
342
 
343
  batch_processed_time = time.time() - batch_start_time
344
- sleep_time = 300 - batch_processed_time
345
 
346
  logger.info(f"Completed compression batch within {batch_processed_time:.2f} seconds")
347
  logger.info(f"Sleeping for {sleep_time:.2f} seconds before next compression batch")
@@ -553,7 +555,7 @@ class Validator(base.BaseValidator):
553
 
554
  vmaf_thresholds = [vmaf_threshold] * len(uids)
555
 
556
- logger.info(f"Compression scoring results for {len(uids)} miners")
557
  logger.info(f"Uids: {uids}")
558
 
559
  for uid, vmaf_score, final_score, reason, compression_rate, applied_multiplier in zip(
@@ -816,7 +818,7 @@ class Validator(base.BaseValidator):
816
 
817
  logger.info("🌜 | UPSCALING | Performing forward operations asynchronously for upscaling 🌜")
818
  forward_tasks = [
819
- self.dendrite.forward(axons=[axon], synapse=synapse, timeout=45)
820
  for axon, synapse in zip(axon_list, synapses)
821
  ]
822
 
@@ -985,7 +987,7 @@ class WeightSynthesizer:
985
  if __name__ == "__main__":
986
  validator = Validator()
987
  weight_synthesizer = WeightSynthesizer(validator)
988
- time.sleep(1300) # wait till the video scheduler is ready
989
 
990
  set_scheduler_ready(validator.redis_conn, False)
991
  logger.info("Set scheduler readiness flag to False")
 
102
  logger.info("βœ… Scheduler is ready! Proceeding with synthetic requests.")
103
 
104
  async def start_synthetic_epoch(self):
105
+ # Wait for scheduler to be ready first
106
+ # await self.wait_for_scheduler_ready()
107
 
108
  logger.info("βœ…βœ…βœ…βœ…βœ… Starting synthetic forward βœ…βœ…βœ…βœ…βœ…")
109
  epoch_start_time = time.time()
 
111
  miner_uids = self.filter_miners()
112
  logger.debug(f"Initialized {len(miner_uids)} subnet neurons of total {len(self.metagraph.S)} neurons")
113
 
114
+ # uids = self.miner_manager.consume(miner_uids)
115
+ uids = [0, 2]
116
 
117
  logger.info(f"Filtered UIDs after consumption: {uids}")
118
 
 
139
  for i, response in enumerate(task_warrant_responses):
140
  uid = random_uids[i]
141
  axon = axons[i]
142
+
143
  if response.warrant_task == TaskType.UPSCALING:
144
  upscaling_miners.append((axon, uid))
145
  elif response.warrant_task == TaskType.COMPRESSION:
 
265
 
266
  logger.debug(f"Processing upscaling UIDs in batch: {uids}")
267
  forward_tasks = [
268
+ self.dendrite.forward(axons=[axon], synapse=synapse, timeout=60)
269
  for axon, synapse in zip(axons, synapses)
270
  ]
271
 
 
285
 
286
  batch_processed_time = time.time() - batch_start_time
287
 
288
+ sleep_time = 80 - batch_processed_time
289
  logger.info(f"Completed upscaling batch within {batch_processed_time:.2f} seconds")
290
  logger.info(f"Sleeping for {sleep_time:.2f} seconds before next upscaling batch")
291
 
 
324
 
325
  logger.debug(f"Processing compression UIDs in batch: {uids}")
326
  forward_tasks = [
327
+ self.dendrite.forward(axons=[axon], synapse=synapse, timeout=60)
328
  for axon, synapse in zip(axons, synapses)
329
  ]
330
 
 
343
  asyncio.create_task(self.score_compressions(uids, responses, payload_urls, reference_video_paths, timestamp, video_ids, uploaded_object_names, vmaf_threshold, round_id))
344
 
345
  batch_processed_time = time.time() - batch_start_time
346
+ sleep_time = 80 - batch_processed_time
347
 
348
  logger.info(f"Completed compression batch within {batch_processed_time:.2f} seconds")
349
  logger.info(f"Sleeping for {sleep_time:.2f} seconds before next compression batch")
 
555
 
556
  vmaf_thresholds = [vmaf_threshold] * len(uids)
557
 
558
+ logger.info(f"Synthetic compression scoring results for {len(uids)} miners")
559
  logger.info(f"Uids: {uids}")
560
 
561
  for uid, vmaf_score, final_score, reason, compression_rate, applied_multiplier in zip(
 
818
 
819
  logger.info("🌜 | UPSCALING | Performing forward operations asynchronously for upscaling 🌜")
820
  forward_tasks = [
821
+ self.dendrite.forward(axons=[axon], synapse=synapse, timeout=60)
822
  for axon, synapse in zip(axon_list, synapses)
823
  ]
824
 
 
987
  if __name__ == "__main__":
988
  validator = Validator()
989
  weight_synthesizer = WeightSynthesizer(validator)
990
+ time.sleep(10) # wait till the video scheduler is ready
991
 
992
  set_scheduler_ready(validator.redis_conn, False)
993
  logger.info("Set scheduler readiness flag to False")
services/video_scheduler/worker.py CHANGED
@@ -668,7 +668,7 @@ async def initialize_environment(redis_conn):
668
  logger.info("Clearing queues and cached content...")
669
  clear_queues(redis_conn)
670
  purge_cached_videos()
671
- await storage_client.delete_all_items()
672
  logger.info("Environment initialized successfully")
673
 
674
 
 
668
  logger.info("Clearing queues and cached content...")
669
  clear_queues(redis_conn)
670
  purge_cached_videos()
671
+ # await storage_client.delete_all_items()
672
  logger.info("Environment initialized successfully")
673
 
674
 
vidaio_subnet_core/configs/video_scheduler.py CHANGED
@@ -5,14 +5,14 @@ class VideoSchedulerConfig(BaseModel):
5
  host: str = Field(default="localhost")
6
  port: int = Field(default=8000)
7
  max_synthetic_queue_size: int = Field(default=100)
8
- refill_target: int = Field(default=100)
9
- refill_threshold: int = Field(default=99)
10
  min_video_len: int = Field(default=29.7)
11
  max_video_len: int = Field(default=40)
12
- pexels_max_size: int = Field(default=110)
13
- pexels_threshold: int = Field(default=109)
14
- weight_hd_to_4k: float = Field(default=0.4)
15
- weight_sd_to_hd: float = Field(default=0.3)
16
  weight_sd_to_4k: float = Field(default=0.3)
17
  weight_4k_to_8k: float = Field(default=0.1)
18
  weight_hd_to_8k: float = Field(default=0.1)
 
5
  host: str = Field(default="localhost")
6
  port: int = Field(default=8000)
7
  max_synthetic_queue_size: int = Field(default=100)
8
+ refill_target: int = Field(default=10)
9
+ refill_threshold: int = Field(default=9)
10
  min_video_len: int = Field(default=29.7)
11
  max_video_len: int = Field(default=40)
12
+ pexels_max_size: int = Field(default=10)
13
+ pexels_threshold: int = Field(default=9)
14
+ weight_hd_to_4k: float = Field(default=0)
15
+ weight_sd_to_hd: float = Field(default=1)
16
  weight_sd_to_4k: float = Field(default=0.3)
17
  weight_4k_to_8k: float = Field(default=0.1)
18
  weight_hd_to_8k: float = Field(default=0.1)
vidaio_subnet_core/protocol.py CHANGED
@@ -170,12 +170,13 @@ class TaskWarrantProtocol(Synapse):
170
 
171
  Attributes:
172
  version (Optional[Version]): The version of the protocol implementation.
173
- warrant_task (TaskType): The type of task the miner can handle,
174
  must be one of the predefined values (COMPRESSION or UPSCALING).
 
175
  """
176
 
177
  version: Optional[Version] = None
178
- warrant_task: TaskType = Field(
179
  description="Type of task miner can handle: COMPRESSION or UPSCALING",
180
- default=TaskType.UPSCALING
181
  )
 
170
 
171
  Attributes:
172
  version (Optional[Version]): The version of the protocol implementation.
173
+ warrant_task (Optional[TaskType]): The type of task the miner can handle,
174
  must be one of the predefined values (COMPRESSION or UPSCALING).
175
+ Will be None if miner doesn't respond, allowing fallback to performance history.
176
  """
177
 
178
  version: Optional[Version] = None
179
+ warrant_task: Optional[TaskType] = Field(
180
  description="Type of task miner can handle: COMPRESSION or UPSCALING",
181
+ default=None
182
  )