1313import time
1414import physigym
1515from gymnasium .spaces import Box
16+ from dataclasses import dataclass
1617
1718class PhysiCellModelWrapper (gym .Wrapper ):
1819 def __init__ (
@@ -143,7 +144,24 @@ def _on_step(self) -> bool:
143144 raise optuna .TrialPruned ()
144145
145146 return True
146-
147+
148+
149+ @dataclass
150+ class TunerConfig :
151+ algo : str = "TQC"
152+ env_id : str = "physigym/ModelPhysiCellEnv-v0"
153+ n_trials : int = 300
154+ total_timesteps : int = int (1e6 )
155+ pruner_type : str = "median"
156+ start_tracking_step : int = 50000
157+ mean_elements : int = int (1e2 )
158+ policy : str = "CnnPolicy"
159+ wandb_project_name : str = "IMAGE_TME_PHYSIGYM"
160+ wandb_entity : str = "corporate-manu-sureli"
161+ eval_frequency : int = int (2.5e4 )
162+ observation_type : str = "image"
163+
164+
147165class RLHyperparamTuner :
148166 def __init__ (self , algo = "TQC" , env_id = "physigym/ModelPhysiCellEnv-v0" , n_trials = 300 , total_timesteps = int (1e6 ), pruner_type = "median" ,
149167 start_tracking_step = 50000 , mean_elements = int (1e2 ), policy = "CnnPolicy" ,
@@ -257,5 +275,12 @@ def run_optimization(self):
257275 print ("✅ Best hyperparameters:" , study .best_params )
258276
259277if __name__ == "__main__" :
260- rlhyperparamtuner = RLHyperparamTuner ()
261- rlhyperparamtuner .run_optimization ()
278+ import tyro
279+ # Parse arguments from the command line
280+ config = tyro .cli (TunerConfig )
281+
282+ # Initialize tuner with parsed configuration
283+ tuner = RLHyperparamTuner (** config .__dict__ )
284+
285+ # Run optimization
286+ tuner .run_optimization ()
0 commit comments