|
7 | 7 | from hydroecolstm.model_run import config_to_search_space |
8 | 8 | from CTkToolTip import CTkToolTip |
9 | 9 | import torch |
| 10 | +from PIL import Image |
| 11 | +from pathlib import Path |
10 | 12 | from ray import tune # is used within the eval function |
11 | 13 |
|
12 | 14 | class TrainTestFrame(ctk.CTkScrollableFrame): |
@@ -34,15 +36,18 @@ def __create_widgets(self): |
34 | 36 | self.ray_tooltip = ('Or input the tune Search Space API command, ' + |
35 | 37 | 'e.g., tune.grid_search([20, 30]). Please see:' + |
36 | 38 | 'https://docs.ray.io/en/latest/tune/api/search_space.html') |
37 | | - |
| 39 | + |
| 40 | + ctk.CTkButton(master=self, anchor='w', fg_color='gray', |
| 41 | + text="Parameter explanation", |
| 42 | + command=self.__parameter_explanation).pack(anchor="e", pady = 10) |
38 | 43 | # ---------------------------------------------Initial state dicts |
39 | 44 | # Load model state dict |
40 | 45 | self.load_model_label = ctk.CTkLabel(self.tabview.tab("1. Initial state dicts"), |
41 | 46 | text="1. Load model state dicts") |
42 | 47 | self.load_model_label.grid(row=0, column=0, sticky = "w") |
43 | 48 | self.load_model = ctk.CTkButton(self.tabview.tab("1. Initial state dicts"), anchor='w', |
44 | 49 | command=self.load_state_dict, |
45 | | - text="Load model") |
| 50 | + text="Load model (optional)") |
46 | 51 | self.load_model.grid(row=1, column=0, sticky = "w") |
47 | 52 | CTkToolTip(self.load_model, delay=0.1, bg_color = 'orange', justify = "left", |
48 | 53 | text_color = 'black', anchor='w', wraplength=250, |
@@ -206,6 +211,20 @@ def __create_widgets(self): |
206 | 211 | self.progressbar.configure(mode="determinate", progress_color="orange") |
207 | 212 | self.progressbar.set(0) |
208 | 213 |
|
| 214 | + |
| 215 | + # Show parameter explanation |
| 216 | + def __parameter_explanation(self): |
| 217 | + |
| 218 | + # Get link to the image |
| 219 | + image = Path(__file__).parents[1] |
| 220 | + button_image = ctk.CTkImage(Image.open( |
| 221 | + Path(image, "images/parameter_explanation.png")), |
| 222 | + size=(800, 400)) |
| 223 | + |
| 224 | + # Create new window |
| 225 | + self.new_window = ctk.CTkToplevel(self, fg_color = "white") |
| 226 | + ctk.CTkLabel(master=self.new_window, image=button_image, text = "").pack() |
| 227 | + |
209 | 228 | # Get number of epochs |
210 | 229 | def get_nepoch(self, dummy): |
211 | 230 | # Get number of hidden layers |
@@ -354,7 +373,7 @@ def load_state_dict(self): |
354 | 373 | self.globalData['init_state_dicts'] = True |
355 | 374 | self.globalData['init_state_dicts_file'] = state_dict_file |
356 | 375 | else: |
357 | | - self.load_model.configure(text = "Load model") |
| 376 | + self.load_model.configure(text = "Load model (optional)") |
358 | 377 | self.globalData['init_state_dicts'] = False |
359 | 378 |
|
360 | 379 | # Message box for error in input with tune search space |
|
0 commit comments