Selaa lähdekoodia

try 内存测试

cdZWj 5 kuukautta sitten
vanhempi
commit
36bf065632
1 muutettua tiedostoa jossa 21 lisäystä ja 7 poistoa
  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()