Browse Source

try 内存测试

cdZWj 5 months ago
parent
commit
36bf065632
1 changed files with 21 additions and 7 deletions
  1. 21 7
      app_test.py

+ 21 - 7
app_test.py

@@ -1,14 +1,28 @@
 
 
-from PointerNet.config import rootdir
-print(rootdir)
+# from PointerNet.config import rootdir
+# print(rootdir)
 
 
-from PointerNet.main import NerPipeline
-from PointerNet.model import UIEModel
-from PointerNet import config
+# from PointerNet.main import NerPipeline
+# from PointerNet.model import UIEModel
+# from PointerNet import config
 
-nerArgs = config.NerArgs()
-print(dir(nerArgs))
+# nerArgs = config.NerArgs()
+# print(dir(nerArgs))
 # model = UIEModel(nerArgs)
 # ner_pipeline = NerPipeline(model, nerArgs)
+
+
+from memory_profiler import profile
+from PointerNet import config
+from PointerNet.predictor import Predictor
+from PointerNet.main import NerPipeline
+from PointerNet.model import UIEModel
+import gc
+
+@profile(precision=2)  # 会显示执行到每一行时所占的总内存
+def run_code():
+    nerArgs = config.NerArgs()
+    pred = Predictor(nerArgs)  # 725M
+run_code()