@@ -12,12 +12,13 @@ The configuration file ``config.yml`` and data for this example can be found `he
1212 from hydroecolstm.utility.plot import plot
1313 from hydroecolstm.data.read_config import read_config
1414 from hydroecolstm.model.create_model import create_model
15+ from hydroecolstm.interface.utility import write_yml_file
1516 from hydroecolstm.utility.evaluation_function import EvaluationFunction
1617 from hydroecolstm.data.read_data import read_forecast_data
1718 import matplotlib.pyplot as plt
1819 from pathlib import Path
1920 import torch
20-
21+
2122 # -----------------------------------------------------------------------------#
2223 # Set up, train, test model #
2324 # -----------------------------------------------------------------------------#
@@ -81,7 +82,8 @@ The configuration file ``config.yml`` and data for this example can be found `he
8182 torch.save(data, Path(config[" output_directory" ][0 ], " data.pt" ))
8283 torch.save(model.state_dict(),
8384 Path(config[" output_directory" ][0 ], " model_state_dict.pt" ))
84-
85+ write_yml_file(config = config,
86+ out_file = Path(config[" output_directory" ][0 ], " best_config.yml" ))
8587 # -----------------------------------------------------------------------------#
8688 # Incase you close this file and open again, #
8789 # you can load your data, model as follows #
@@ -93,7 +95,7 @@ The configuration file ``config.yml`` and data for this example can be found `he
9395 " model_state_dict.pt" )))
9496
9597 data = torch.load(Path(config[" output_directory" ][0 ], " data.pt" ))
96-
98+
9799
98100 Multiple outputs simulation
99101---------------------------
@@ -102,12 +104,11 @@ The configuration file ``config.yml`` and data for this example can be found `he
102104
103105.. code-block :: python
104106
105- # Import hydroecolstm function
106-
107107 from hydroecolstm.model_run import run_config
108108 from hydroecolstm.utility.plot import plot
109109 from hydroecolstm.data.read_config import read_config
110110 from hydroecolstm.model.create_model import create_model
111+ from hydroecolstm.interface.utility import write_yml_file
111112 from hydroecolstm.utility.evaluation_function import EvaluationFunction
112113 import matplotlib.pyplot as plt
113114 from pathlib import Path
@@ -151,14 +152,16 @@ The configuration file ``config.yml`` and data for this example can be found `he
151152 torch.save(data, Path(config[" output_directory" ][0 ], " data.pt" ))
152153 torch.save(model.state_dict(),
153154 Path(config[" output_directory" ][0 ], " model_state_dict.pt" ))
155+ write_yml_file(config = best_config,
156+ out_file = Path(config[" output_directory" ][0 ], " best_config.yml" ))
154157
155158 # -----------------------------------------------------------------------------#
156159 # Incase you close this file and open again, #
157160 # you can load your data, model as follows #
158161 # -----------------------------------------------------------------------------#
159- config = read_config(" C:/hydroecolstm/examples/2_streamflow_isotope_simulation/config .yml" )
162+ config = read_config(" C:/hydroecolstm/examples/2_streamflow_isotope_simulation/results/best_config .yml" )
160163 model = create_model(config)
161164 model.load_state_dict(torch.load(Path(config[" output_directory" ][0 ],
162165 " model_state_dict.pt" )))
163166 data = torch.load(Path(config[" output_directory" ][0 ], " data.pt" ))
164-
167+
0 commit comments