@@ -199,7 +199,7 @@ async def _initialize_search_parameters(self, *,
199199 """
200200 # Validate and adjust num_candidates
201201 if num_candidates < len (self ._optimizers ):
202- print (f"Warning: num_candidates { num_candidates } is less than the number of optimizers { len (self ._optimizers )} . Setting num_candidates to { len (self ._optimizers )} ." )
202+ print (f"[AsyncPrioritySearch] Warning: num_candidates { num_candidates } is less than the number of optimizers { len (self ._optimizers )} . Setting num_candidates to { len (self ._optimizers )} ." )
203203 num_candidates = len (self ._optimizers )
204204
205205 # Set core parameters
@@ -230,15 +230,15 @@ async def _initialize_search_parameters(self, *,
230230
231231 # Initialize memory structures
232232 if memory_update_frequency is None :
233- print ("AsyncPrioritySearch initialized with only short-term memory." )
233+ print ("[AsyncPrioritySearch] AsyncPrioritySearch initialized with only short-term memory." )
234234 assert short_term_memory_size is None or short_term_memory_size > 0 , \
235235 "short_term_memory_size must be None or greater than 0 when memory_update_frequency is None."
236236 elif memory_update_frequency == 0 :
237- print ("AsyncPrioritySearch initialized with only long-term memory." )
237+ print ("[AsyncPrioritySearch] AsyncPrioritySearch initialized with only long-term memory." )
238238 assert long_term_memory_size is None or long_term_memory_size > 0 , \
239239 "long_term_memory_size must be None or greater than 0 when memory_update_frequency is 0."
240240 else :
241- print (f"AsyncPrioritySearch initialized with both short-term and long-term memory. Candidates will be merged into long-term memory every { memory_update_frequency } iterations." )
241+ print (f"[AsyncPrioritySearch] AsyncPrioritySearch initialized with both short-term and long-term memory. Candidates will be merged into long-term memory every { memory_update_frequency } iterations." )
242242
243243 self .long_term_memory = HeapMemory (size = long_term_memory_size , processing_fun = self .compress_candidate_memory )
244244 self .short_term_memory = HeapMemory (size = short_term_memory_size )
@@ -270,7 +270,7 @@ def memory(self):
270270 if self .n_iters % self .memory_update_frequency == 0 :
271271 # Merge short-term memory into long-term memory
272272 if len (self .short_term_memory ) > 0 :
273- print ('Merging short-term memory into long-term memory.' )
273+ print ('[AsyncPrioritySearch] Merging short-term memory into long-term memory.' )
274274 self .long_term_memory .append (self .short_term_memory )
275275 self .short_term_memory .reset ()
276276 return self .long_term_memory
@@ -371,7 +371,7 @@ async def propose(self, samples: Samples, exploration_candidates: List[ModuleCan
371371 Returns:
372372 List of proposed ModuleCandidate objects
373373 """
374- print ("--- Proposing new parameters..." ) if verbose else None
374+ print ("[AsyncPrioritySearch] --- Proposing new parameters..." ) if verbose else None
375375 assert isinstance (samples , Samples ), "samples must be an instance of Samples."
376376 samples_list = samples .samples # list of BatchRollout objects
377377 n_proposals = self .num_proposals
@@ -405,7 +405,7 @@ async def _backward(n):
405405 return optimizer
406406
407407 # Run backward passes concurrently
408- print (f"Running backward on { n_batches } batches..." ) if verbose else None
408+ print (f"[AsyncPrioritySearch] Running backward on { n_batches } batches..." ) if verbose else None
409409 optimizers = await asyncio .gather (* [_backward (n ) for n in range (n_batches )])
410410 assert len (optimizers ) == n_batches , "Number of optimizers must match number of batch rollouts."
411411
@@ -432,7 +432,7 @@ async def _step(n):
432432 return update_dict
433433
434434 # Run step operations concurrently
435- print (f"Generating { n_proposals } proposals for each of { n_batches } batches..." ) if verbose else None
435+ print (f"[AsyncPrioritySearch] Generating { n_proposals } proposals for each of { n_batches } batches..." ) if verbose else None
436436 update_dicts = await asyncio .gather (* [_step (n ) for n in range (n_batches * n_proposals )])
437437
438438 # Clear optimizer state TODO is this for preventing memory leak?
@@ -467,7 +467,7 @@ async def validate(self,
467467 Returns:
468468 Dictionary mapping ModuleCandidate to list of rollouts
469469 """
470- print ("--- Validating candidates..." ) if verbose else None
470+ print ("[AsyncPrioritySearch] --- Validating candidates..." ) if verbose else None
471471 assert isinstance (samples , Samples ), "samples must be an instance of Samples."
472472 assert exploration_candidates is not None , "exploration_candidate must be set."
473473
@@ -537,7 +537,7 @@ async def update_memory(self, validate_results: Dict[ModuleCandidate, List[Dict[
537537 verbose: Whether to print verbose output
538538 **kwargs: Additional keyword arguments
539539 """
540- print ("--- Updating memory with validation results..." ) if verbose else None
540+ print ("[AsyncPrioritySearch] --- Updating memory with validation results..." ) if verbose else None
541541 for candidate , rollouts in validate_results .items ():
542542 candidate .add_rollouts (rollouts )
543543 priority = self .compute_exploration_priority (candidate )
@@ -560,7 +560,7 @@ async def explore(self,
560560 priorities: List of priorities for candidates
561561 info_dict: Dictionary with logging information
562562 """
563- print (f"--- Generating { min (len (self .memory ), num_candidates )} exploration candidates..." ) if verbose else None
563+ print (f"[AsyncPrioritySearch] --- Generating { min (len (self .memory ), num_candidates )} exploration candidates..." ) if verbose else None
564564
565565 top_candidates = [self ._best_candidate ] if use_best_candidate_to_explore else []
566566 priorities = [self ._best_candidate_priority ] if use_best_candidate_to_explore else []
@@ -599,7 +599,7 @@ async def exploit(self, verbose: bool = False, **kwargs) -> Tuple[ModuleCandidat
599599 priority: Priority of best candidate
600600 info_dict: Dictionary with logging information
601601 """
602- print ("--- Exploiting the best candidate..." ) if verbose else None
602+ print ("[AsyncPrioritySearch] --- Exploiting the best candidate..." ) if verbose else None
603603 if not self .memory :
604604 raise ValueError ("The priority queue is empty. Cannot exploit." )
605605
0 commit comments