Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logging #62

Merged
merged 32 commits into from
Oct 14, 2021
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
601dbd4
move main.py and fix mypy
dayyass Oct 13, 2021
a23f45f
update Makefile
dayyass Oct 13, 2021
f8fad6d
add main and init
dayyass Oct 13, 2021
d159e57
update Dockerfile
dayyass Oct 13, 2021
7c8072b
rename train functions
dayyass Oct 13, 2021
5e19658
move argparse into utils
dayyass Oct 13, 2021
3b1a3da
add logging
dayyass Oct 13, 2021
ba3cc3e
parametrize train with config and logger
dayyass Oct 13, 2021
536c9f6
add python and terminal versions
dayyass Oct 13, 2021
9e2fa3d
refactor config
dayyass Oct 13, 2021
b2da49c
refactor logging
dayyass Oct 13, 2021
956cc78
update rnn layers
dayyass Oct 13, 2021
def3587
change save folder
dayyass Oct 13, 2021
816d70c
change save folder
dayyass Oct 13, 2021
09ad5e1
update tests
dayyass Oct 13, 2021
dbe5b7f
tests hotfix
dayyass Oct 13, 2021
ac2b491
add data readme
dayyass Oct 13, 2021
cd69379
update config/save
dayyass Oct 13, 2021
571fc91
log config
dayyass Oct 13, 2021
5aec5fa
save config and logfile
dayyass Oct 13, 2021
794aa6b
replace f1-micro with f1-weighted
dayyass Oct 13, 2021
e2e1f45
replace val with valid
dayyass Oct 13, 2021
9fc55b0
minor changes
dayyass Oct 13, 2021
dfc512c
fix test
dayyass Oct 14, 2021
ac57d12
fix warning
dayyass Oct 14, 2021
b0c33ab
add train test
dayyass Oct 14, 2021
6d4a352
migrate from codecov-action@v1 to v2
dayyass Oct 14, 2021
1068d1d
hotfix dockerfile
dayyass Oct 14, 2021
de42ed9
minor renaming
dayyass Oct 14, 2021
5291931
add tear_dowm
dayyass Oct 14, 2021
43e4d2c
improve coverage
dayyass Oct 14, 2021
89247f1
add train without test file
dayyass Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests
dayyass committed Oct 13, 2021
commit 09ad5e1d9ab61ec39ef585e509a355c3e4856e86
2 changes: 0 additions & 2 deletions tests/test_onnx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pytorch_ner.onnx import onnx_export_and_check
from pytorch_ner.utils import mkdir
from tests.test_nn_modules.test_architecture import model_bilstm as model

path_to_save = "models/model.onnx"
mkdir("models")

onnx_export_and_check(model=model, path_to_save=path_to_save)
20 changes: 9 additions & 11 deletions tests/test_save.py
Original file line number Diff line number Diff line change
@@ -7,11 +7,9 @@
from pytorch_ner.utils import rmdir
from tests.test_train import label2idx, model, token2idx

path_to_folder = "models/test_save/"
path_to_onnx_folder = "models/test_onnx_save/"

rmdir(path_to_folder)
rmdir(path_to_onnx_folder)
path_to_save_folder = "models/test"
path_to_no_onnx_folder = os.path.join(path_to_save_folder, "no_onnx")
path_to_onnx_folder = os.path.join(path_to_save_folder, "onnx")


with open("config.yaml", "r") as fp:
@@ -20,7 +18,7 @@

# without onnx
save_model(
path_to_folder=path_to_folder,
path_to_folder=path_to_no_onnx_folder,
model=model,
token2idx=token2idx,
label2idx=label2idx,
@@ -40,14 +38,14 @@


class TestSave(unittest.TestCase):
def test_mkdir(self):
self.assertTrue(os.path.exists(path_to_folder))

def test_num_files(self):
self.assertTrue(len(os.listdir(path_to_folder)) == 4)
self.assertTrue(len(os.listdir(os.listdir(path_to_no_onnx_folder)[0])) == 4)

def test_num_files_with_onnx(self):
self.assertTrue(len(os.listdir(path_to_onnx_folder)) == 5)
self.assertTrue(len(os.listdir(os.listdir(path_to_onnx_folder)[0])) == 5)

def tearDownClass(cls):
rmdir(path_to_save_folder)


if __name__ == "__main__":