Jittor / jittor

Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.
https://cg.cs.tsinghua.edu.cn/jittor/
Apache License 2.0
3.08k stars 311 forks source link

RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.item)). 怎么解决? #440

Closed ewwerpm closed 4 months ago

ewwerpm commented 1 year ago

我google了一下,没找到和我一模一样的问题。这里,我输入“一加一等于几?”,是输入格式不对吗?要如何输入?谢谢 [i 0518 00:18:24.721000 20 cuda_flags.cc:39] CUDA enabled. 用户输入: 一加一等于几? [e 0518 00:19:41.320000 20 log.cc:565] Traceback (most recent call last): File "D:\myProgram\ideaJava\yiZhiXiangMuZu\Jittor\JittorLLMs\cli_demo.py", line 9, in model.chat() File "D:\myProgram\ideaJava\yiZhiXiangMuZu\Jittor\JittorLLMs\models\chatglm__init__.py", line 36, in chat for response, history in self.model.stream_chat(self.tokenizer, text, history=history): File "C:\Users\Administrator/.cache\huggingface\modules\transformers_modules\local\modeling_chatglm.py", line 1259, in stream_chat for outputs in self.stream_generate(input_ids, gen_kwargs): File "C:\Users\Administrator/.cache\huggingface\modules\transformers_modules\local\modeling_chatglm.py", line 1334, in stream_generate model_inputs = self.prepare_inputs_for_generation(input_ids, **model_kwargs) File "C:\Users\Administrator/.cache\huggingface\modules\transformers_modules\local\modeling_chatglm.py", line 1083, in prepare_inputs_for_generation mask_token = MASK if MASK in input_ids else gMASK File "D:\Program Files\python39\python39\lib\site-packages\jittor\misc.py", line 132, in contains return bool((x == key).any()) File "D:\Program Files\python39\python39\lib\site-packages\jittor__init__.py", line 2013, in to_bool return ori_bool(v.item()) RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.item)).

Types of your inputs are: self = Var, args = (),

The function declarations are: ItemData item()

Failed reason:[f 0518 00:19:41.322000 20 parallel_compiler.cc:330] Error happend during compilation: [Error] source file location:C:\Users\Administrator.cache\jittor\jt1.3.7\cl\py3.9.13\Windows-10-10.x0c\11thGenIntelRCx42\default\cu11.2.67\jit__opkey0_arrayT_int32__o_1JIT_1JIT_cuda_1graph_var_info21__index_t_int32_hash_81afca ae637f9142_op.cc Compile fused operator(0/3)failed:[Op(11991:0:1:1:i0:o1:s0,array->11992),]

Reason: [f 0518 00:19:41.320000 20 log.cc:608] Check failed ret(1) == 0(0) Run cmd failed: "C:\Users\Administrator.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe" "C:\Users\Administrator.cache\jittor\jt1.3.7\cl\py3.9.13\Windows-10-10 .x0c\11thGenIntelRCx42\default\cu11.2.67\jit__opkey0_arrayT_int32__o_1JIT_1JIT_cuda_1graph_var_info21index_t_int32_hash_81afcaae637f9142_op.cc" -shared -L"D:\Program Files\python39\python39\libs" -lpython39 -Xcomp iler -EHa -Xcompiler -MD -Xcompiler -utf-8 -I"C:\Users\Administrator.cache\jittor\msvc\VC\include" -I"C:\Users\Administrator.cache\jittor\msvc\win10_kits\include\ucrt" -I"C:\Users\Administrator.cache\jittor\msvc\win10_kits\include\share d" -I"C:\Users\Administrator.cache\jittor\msvc\win10_kits\include\um" -DNOMINMAX -L"C:\Users\Administrator.cache\jittor\msvc\VC\lib" -L"C:\Users\Administrator.cache\jittor\msvc\win10_kits\lib\um\x64" -L"C:\Users\Administrator.cache\jitt or\msvc\win10_kits\lib\ucrt\x64" -I"d:\program files\python39\python39\lib\site-packages\jittor\src" -I"D:\Program Files\python39\python39\include" -DHAS_CUDA -DIS_CUDA -I"C:\Users\Administrator.cache\jittor\jtcuda\cuda11.2_cudnn8_win\incl ude" -I"d:\program files\python39\python39\lib\site-packages\jittor\extern\cuda\inc" -lcudart -L"C:\Users\Administrator.cache\jittor\jtcuda\cuda11.2_cudnn8_win\lib\x64" -L"C:\Users\Administrator.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin " -I"C:\Users\Administrator.cache\jittor\jt1.3.7\cl\py3.9.13\Windows-10-10.x0c\11thGenIntelRCx42\default\cu11.2.67" -L"C:\Users\Administrator.cache\jittor\jt1.3.7\cl\py3.9.13\Windows-10-10.x0c\11thGenIntelRCx42\default\cu11.2.67" -L"C:\Us ers\Administrator.cache\jittor\jt1.3.7\cl\py3.9.13\Windows-10-10.x0c\11thGenIntelRCx42\default" -l"jit_utils_core.cp39-win_amd64" -l"jittor_core.cp39-winamd64" -x cu --cudart=shared -ccbin="C:\Users\Administrator.cache\jittor\msvc\VC_ ___\\bin\cl.exe" --use_fast_math -w -I"d:\program files\python39\python39\lib\site-packages\jittor\extern/cuda/inc" -arch=compute_75 -code=sm_75 -o "C:\Users\Administrator.cache\jittor\jt1.3.7\cl\py3.9.13\Windows-10-10.x0c\11thGenI ntelRCx42\default\cu11.2.67\jit__opkey0_arrayT_int32o_1__JIT_1JIT_cuda_1graph___var_info21__index_t_int32_hash_81afcaae637f9142_op.dll" -Xlinker -EXPORT:"?jit_run@FusedOp@jittor@@QEAAXXZ"

GavinSun0921 commented 1 year ago

同样遇到该问题,对于出现这个问题的变量,打印其类型为<class 'jittor.jittor_core.Var>,dtype为{NanoString}float32 这个变量在调用其.item().data时会报错,日志类似于上面的日志。 希望知道如何解决