Commit 95f3d64
authored
Fix bugs in Executor (#306)
* Fix: saved `meta_dict` contains excessive data
- `meta_dict` contains training and evaluation metrics objects, but it's
unnecessary to save objects -- only their values are needed.
- A more serious problem is with the `LR` metric, which stores a
reference to the optimizer. This will result in the entire optimizer
being saved in the meta-info.
- Solution is two parts: 1) save only the metric values; 2) store the
optimizer as a weakref.
* Fix: don't close files when calling test in train
- `_open_files` and `_close_files` are called at the beginning and end
of `train` and `test`, to prevent holding on to an open file object
for an unnecessarily long amount of time.
- However, it's possible that we call `test` within `train`. For
instance, calling `test` in a action triggered by the validation
event. In this case, the file will be closed before training ends.
- Solution is to check whether we need to open files, and if we don't,
then don't open nor close them.
* Fix: missing call to tracker in `_validate_loop`
This is so stupid: for some reason I forgot to call `_valid_tracker.add`
in `_validate_loop`, so the status is never updated during validation.
* Revert c89e0e4: fix `meta_dict` issue
- It turns out we must store the metric objects -- otherwise we can't
even compare two metric values.
- So I just changed the pickle behavior for `LR` so that it doesn't save
the optimizer. Seems like a hack, but let's just leave it at this.
* Fix doc building issues1 parent 27fe398 commit 95f3d64
File tree
4 files changed
+41
-18
lines changed- docs/code
- tests/run
- texar/torch/run
- metric
4 files changed
+41
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | 135 | | |
139 | 136 | | |
140 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1280 | 1280 | | |
1281 | 1281 | | |
1282 | 1282 | | |
1283 | | - | |
1284 | | - | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1285 | 1289 | | |
1286 | 1290 | | |
1287 | 1291 | | |
| |||
1351 | 1355 | | |
1352 | 1356 | | |
1353 | 1357 | | |
1354 | | - | |
1355 | | - | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1356 | 1361 | | |
1357 | 1362 | | |
1358 | 1363 | | |
| |||
1369 | 1374 | | |
1370 | 1375 | | |
1371 | 1376 | | |
1372 | | - | |
1373 | | - | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
1374 | 1383 | | |
1375 | 1384 | | |
1376 | 1385 | | |
| |||
1417 | 1426 | | |
1418 | 1427 | | |
1419 | 1428 | | |
1420 | | - | |
1421 | | - | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1422 | 1432 | | |
1423 | 1433 | | |
1424 | 1434 | | |
| |||
1728 | 1738 | | |
1729 | 1739 | | |
1730 | 1740 | | |
| 1741 | + | |
1731 | 1742 | | |
1732 | 1743 | | |
1733 | 1744 | | |
| |||
1890 | 1901 | | |
1891 | 1902 | | |
1892 | 1903 | | |
1893 | | - | |
| 1904 | + | |
1894 | 1905 | | |
1895 | 1906 | | |
1896 | 1907 | | |
| |||
1906 | 1917 | | |
1907 | 1918 | | |
1908 | 1919 | | |
1909 | | - | |
1910 | | - | |
| 1920 | + | |
1911 | 1921 | | |
1912 | 1922 | | |
1913 | 1923 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
155 | | - | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
162 | | - | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
0 commit comments