35
35
from torax .config import config_loader
36
36
from torax .config import runtime_params
37
37
from torax .plotting import plotruns_lib
38
- from torax .transport_model import qlknn_transport_model
39
38
40
39
41
40
# String used when prompting the user to make a choice of command
101
100
'If True, quits after the first operation (no interactive mode).' ,
102
101
)
103
102
104
- _QLKNN_MODEL_PATH = flags .DEFINE_string (
105
- 'qlknn_model_path' ,
106
- None ,
107
- 'Path to the qlknn model network parameters (if using a QLKNN transport'
108
- ' model). If not set, then it will use the value from the config in the'
109
- ' "model_path" field in the qlknn_params. If that is not set, it will look'
110
- f' for the "{ qlknn_transport_model .MODEL_PATH_ENV_VAR } " env variable.'
111
- ' Finally, if this is also not set, it uses a hardcoded default path'
112
- f' "{ qlknn_transport_model .DEFAULT_MODEL_PATH } ".' ,
113
- )
114
-
115
103
_OUTPUT_DIR = flags .DEFINE_string (
116
104
'output_dir' ,
117
105
None ,
@@ -204,7 +192,6 @@ def maybe_update_config_module(
204
192
def change_config (
205
193
sim : sim_lib .Sim ,
206
194
config_module_str : str ,
207
- qlknn_model_path : str | None ,
208
195
) -> tuple [sim_lib .Sim , runtime_params .GeneralRuntimeParams ] | None :
209
196
"""Returns a new Sim with the updated config but same SimulationStepFn.
210
197
@@ -219,7 +206,6 @@ def change_config(
219
206
Args:
220
207
sim: Sim object used in the previous run.
221
208
config_module_str: Config module being used.
222
- qlknn_model_path: QLKNN model path set by flag.
223
209
224
210
Returns:
225
211
Tuple with:
@@ -257,9 +243,6 @@ def change_config(
257
243
if hasattr (config_module , 'CONFIG' ):
258
244
# Assume that the config module uses the basic config dict to build Sim.
259
245
sim_config = config_module .CONFIG
260
- config_loader .maybe_update_config_with_qlknn_model_path (
261
- sim_config , qlknn_model_path
262
- )
263
246
new_runtime_params = build_sim .build_runtime_params_from_config (
264
247
sim_config ['runtime_params' ]
265
248
)
@@ -316,7 +299,7 @@ def change_config(
316
299
317
300
318
301
def change_sim_obj (
319
- config_module_str : str , qlknn_model_path : str | None
302
+ config_module_str : str
320
303
) -> tuple [sim_lib .Sim , runtime_params .GeneralRuntimeParams , str ]:
321
304
"""Builds a new Sim from the config module.
322
305
@@ -327,7 +310,6 @@ def change_sim_obj(
327
310
Args:
328
311
config_module_str: Config module used previously. User will have the
329
312
opportunity to update which module to load.
330
- qlknn_model_path: QLKNN model path set by flag.
331
313
332
314
Returns:
333
315
Tuple with:
@@ -344,7 +326,7 @@ def change_sim_obj(
344
326
input ('Press Enter when done changing the module.' )
345
327
sim , new_runtime_params = (
346
328
config_loader .build_sim_and_runtime_params_from_config_module (
347
- config_module_str , qlknn_model_path , _PYTHON_CONFIG_PACKAGE .value
329
+ config_module_str , _PYTHON_CONFIG_PACKAGE .value
348
330
)
349
331
)
350
332
return sim , new_runtime_params , config_module_str
@@ -482,15 +464,14 @@ def main(_):
482
464
log_sim_progress = _LOG_SIM_PROGRESS .value
483
465
plot_sim_progress = _PLOT_SIM_PROGRESS .value
484
466
log_sim_output = _LOG_SIM_OUTPUT .value
485
- qlknn_model_path = _QLKNN_MODEL_PATH .value
486
467
sim = None
487
468
new_runtime_params = None
488
469
output_files = []
489
470
try :
490
471
start_time = time .time ()
491
472
sim , new_runtime_params = (
492
473
config_loader .build_sim_and_runtime_params_from_config_module (
493
- config_module_str , qlknn_model_path , _PYTHON_CONFIG_PACKAGE .value
474
+ config_module_str , _PYTHON_CONFIG_PACKAGE .value
494
475
)
495
476
)
496
477
output_dir = (
@@ -573,8 +554,7 @@ def main(_):
573
554
try :
574
555
start_time = time .time ()
575
556
sim_and_runtime_params_or_none = change_config (
576
- sim , config_module_str , qlknn_model_path
577
- )
557
+ sim , config_module_str )
578
558
if sim_and_runtime_params_or_none is not None :
579
559
sim , new_runtime_params = sim_and_runtime_params_or_none
580
560
config_change_time = time .time () - start_time
@@ -595,7 +575,7 @@ def main(_):
595
575
try :
596
576
start_time = time .time ()
597
577
sim , new_runtime_params , config_module_str = change_sim_obj (
598
- config_module_str , qlknn_model_path
578
+ config_module_str
599
579
)
600
580
sim_change_time = time .time () - start_time
601
581
simulation_app .log_to_stdout (
0 commit comments