-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dlt.TranslationModel.load_obj (#34)
* Create test for saving/loading models * Improve tests * TranslationModel.save_obj now saves dlt config * Bump version
- Loading branch information
Xing Han Lu
authored
Apr 8, 2021
1 parent
6279c4c
commit cfa6f9e
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
|
||
import dl_translate as dlt | ||
|
||
|
||
def test_save(): | ||
mt = dlt.TranslationModel() | ||
mt.save_obj("saved_model") | ||
assert os.path.exists("saved_model/weights.pt") | ||
assert os.path.exists("saved_model/tokenizer_config.json") | ||
|
||
|
||
def test_load(): | ||
mt = dlt.TranslationModel.load_obj("saved_model") | ||
assert isinstance(mt, dlt.TranslationModel) |