From 174ce35fc89748b808e546d50d5753d0e9d1e68f Mon Sep 17 00:00:00 2001 From: FengZiYjun Date: Mon, 16 Jul 2018 21:20:51 +0800 Subject: [PATCH] delete unnecessary files --- .idea/deployment.xml | 15 --------------- .idea/fastNLP.iml | 14 -------------- .idea/inspectionProfiles/Project_Default.xml | 16 ---------------- .idea/misc.xml | 7 ------- .idea/modules.xml | 8 -------- .idea/other.xml | 7 ------- .idea/vcs.xml | 6 ------ fastNLP/action/tester.py | 6 ++---- fastNLP/modules/other_modules.py | 11 ++++++----- test/test_POS_pipeline.py | 2 +- 10 files changed, 9 insertions(+), 83 deletions(-) delete mode 100644 .idea/deployment.xml delete mode 100644 .idea/fastNLP.iml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/other.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/deployment.xml b/.idea/deployment.xml deleted file mode 100644 index a96dc15a..00000000 --- a/.idea/deployment.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/fastNLP.iml b/.idea/fastNLP.iml deleted file mode 100644 index 16c9ef16..00000000 --- a/.idea/fastNLP.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index a2c4d0fd..00000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7053f4f5..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8427b4d7..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/other.xml b/.idea/other.xml deleted file mode 100644 index 640fd80b..00000000 --- a/.idea/other.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/fastNLP/action/tester.py b/fastNLP/action/tester.py index 39fc896b..675537b8 100644 --- a/fastNLP/action/tester.py +++ b/fastNLP/action/tester.py @@ -158,8 +158,8 @@ class POSTester(BaseTester): def evaluate(self, predict, truth): truth = torch.Tensor(truth) loss, prediction = self.model.loss(predict, truth, self.mask, self.batch_size, self.max_len) - results = torch.Tensor(prediction[0][0]).view((-1, )) - accuracy = float(torch.sum(results == truth.view((-1, )))) / results.shape[0] + results = torch.Tensor(prediction[0][0]).view((-1,)) + accuracy = float(torch.sum(results == truth.view((-1,)))) / results.shape[0] return [loss.data, accuracy] def matrices(self): @@ -174,5 +174,3 @@ class POSTester(BaseTester): """ loss, accuracy = self.matrices() return "dev loss={:.2f}, accuracy={:.2f}".format(loss, accuracy) - - diff --git a/fastNLP/modules/other_modules.py b/fastNLP/modules/other_modules.py index 5e91e94f..cd4b225f 100644 --- a/fastNLP/modules/other_modules.py +++ b/fastNLP/modules/other_modules.py @@ -2,16 +2,17 @@ This is borrowed from FudanParser. Not stable. Do not use !!! """ +import numpy import numpy as np +import torch import torch.nn as nn import torch.nn.functional as F -from torch.nn import Parameter -from .utils import orthogonal -import torch import torch.utils.data -import numpy -from torch.autograd import Function, Variable from torch import optim +from torch.autograd import Function, Variable +from torch.nn import Parameter + +from .utils import orthogonal class GroupNorm(nn.Module): diff --git a/test/test_POS_pipeline.py b/test/test_POS_pipeline.py index 2711ac8d..dba70976 100644 --- a/test/test_POS_pipeline.py +++ b/test/test_POS_pipeline.py @@ -53,7 +53,7 @@ if __name__ == "__main__": test_args = ConfigSection() ConfigLoader("config.cfg", "").load_config("./data_for_tests/config", {"POS_test": test_args}) - #test_args = {"save_output": True, "validate_in_training": False, "save_dev_input": False, + # test_args = {"save_output": True, "validate_in_training": False, "save_dev_input": False, # "save_loss": True, "batch_size": 1, "pickle_path": pickle_path} tester = POSTester(test_args) tester.test(model)