PaddleNLP icon indicating copy to clipboard operation
PaddleNLP copied to clipboard

为什么无法在intellij中打印出结果?

Open gongshaojie12 opened this issue 3 years ago • 9 comments

  • 版本、环境信息 1)PaddleNLP 2.3.5,PaddlePaddle2.3.1 2)系统环境:Windows,python3.6.13

代码:

from paddlenlp import Taskflow
from pprint import pprint
ner = Taskflow("ner")
result = ner(["热梅茶是一道以梅子为主要原料制作的茶饮", "《孤女》是2010年九州出版社出版的小说,作者是余兼羽"])
pprint("ner result:")
pprint("result:", result)

Intellij 控制台打印出的信息如下:

[2022-08-23 15:56:30,403] [    INFO] - Already cached C:\Users\g\.paddlenlp\models\wordtag\vocab.txt
[2022-08-23 15:56:30,442] [    INFO] - tokenizer config file saved in C:\Users\g\.paddlenlp\models\wordtag\tokenizer_config.json
[2022-08-23 15:56:30,443] [    INFO] - Special tokens file saved in C:\Users\g\.paddlenlp\models\wordtag\special_tokens_map.json
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m

Process finished with exit code -1073741819 (0xC0000005)

控制台无法输出print和ppring中的信息,请问下是什么原因?谢谢!

gongshaojie12 avatar Aug 23 '22 08:08 gongshaojie12

可以打开控制台检查下内存是否溢出

LemonNoel avatar Aug 23 '22 08:08 LemonNoel

image hi, @LemonNoel 是指这里的控制台吗?

gongshaojie12 avatar Aug 23 '22 09:08 gongshaojie12

Intellij 的idea64.exe.vmoptions设置如下:

-Xms16384m
-Xmx16384m
-Xmn2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true

但还是无法打印出结果。

gongshaojie12 avatar Aug 24 '22 07:08 gongshaojie12

pprint("ner result:") 在这里打个断点,调试一下

MachineSheep avatar Aug 25 '22 04:08 MachineSheep

pprint("ner result:") 在这里打个断点,调试一下

还没运行到这一行程序就停止了

gongshaojie12 avatar Aug 25 '22 05:08 gongshaojie12

pprint("ner result:") 在这里打个断点,调试一下

还没运行到这一行程序就停止了 那就不是无法在intellij中打印出结果的问题,问的方式有问题

MachineSheep avatar Aug 25 '22 12:08 MachineSheep

我在使用UIE训练到epoch 1时,也遇到过这个报错,我的解决方法是将Scipy版本降低至1.3.1

pip install Scipy==1.3.1

你可以试一下能否解决你的问题

FFinchR avatar Aug 26 '22 08:08 FFinchR

@MachineSheep 我把代码改成了下面这样:

from paddlenlp import Taskflow
from pprint import pprint
ner = Taskflow("ner")
result = ner(["热梅茶是一道以梅子为主要原料制作的茶饮", "《孤女》是2010年九州出版社出版的小说,作者是余兼羽"])
print("ner result:")
print("result:", result)

在intellij中还是打印不出结果,但是在anaconda中运行 python script.py 可以打印出结果 image

gongshaojie12 avatar Aug 26 '22 09:08 gongshaojie12

@FFinchR 我把Scipy版本改成了1.3.1,现在intellij可以正常打印出结果了,谢谢!

gongshaojie12 avatar Aug 26 '22 09:08 gongshaojie12

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] avatar Dec 08 '22 02:12 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。

github-actions[bot] avatar Dec 22 '22 16:12 github-actions[bot]