Skip to content

Commit e7c38e5

Browse files
authored
fixing TrDesign bug (best result not saved) (#106)
* Update README.md * fix best save in TrDesign
1 parent 9f54bf3 commit e7c38e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

colabdesign/tr/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ def step(self, backprop=True, callback=None, save_best=True, verbose=1):
255255
self._k += 1
256256

257257
# save results
258-
if save_best and "aux" in self._tmp["best"] and self.aux["loss"] < self._tmp["best"]["aux"]["loss"]:
259-
self._tmp["best"]["aux"] = self.aux
258+
if save_best:
259+
if "aux" not in self._tmp["best"] or self.aux["loss"] < self._tmp["best"]["aux"]["loss"]:
260+
self._tmp["best"]["aux"] = self.aux
260261

261262
# print
262263
if verbose and (self._k % verbose) == 0:

0 commit comments

Comments
 (0)