Commit 8d4849c
authored
fix: make --continue_path work again (#131)
* fix: make --continue_path work again
There were errors when loading models with `--continue_path` because #121
changed
https://github.com/coqui-ai/Trainer/blob/47781f58d2714d8139dc00f57dbf64bcc14402b7/trainer/trainer.py#L1924
to save the `model_loss` as `{"train_loss": train_loss, "eval_loss": eval_loss}`
instead of just a float.
https://github.com/coqui-ai/Trainer/blob/47781f58d2714d8139dc00f57dbf64bcc14402b7/trainer/io.py#L195
still saves a float in `model_loss`, so loading the best model would still work
fine. Loading a model via `--restore-path` also works fine because in that case
the best loss is reset and not initialised from the saved model.
This fix:
- changes `save_best_model()` to also save a dict with train and eval loss, so
that this is consistent everywhere
- ensures that the model loader can handle both float and dict
`model_loss` for backwards compatibility
- adds relevant test cases
* fixup! fix: make --continue_path work again1 parent 463e763 commit 8d4849c
3 files changed
+27
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
21 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| |||
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
1727 | | - | |
1728 | | - | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1729 | 1736 | | |
1730 | 1737 | | |
1731 | 1738 | | |
| |||
1907 | 1914 | | |
1908 | 1915 | | |
1909 | 1916 | | |
1910 | | - | |
| 1917 | + | |
1911 | 1918 | | |
1912 | 1919 | | |
1913 | 1920 | | |
| |||
0 commit comments