ChatGLM-6B icon indicating copy to clipboard operation
ChatGLM-6B copied to clipboard

[BUG/Help]gcc编译第一个kernel报错,编译第二个成功,但是无法加载so

Open zyuerugou opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

调用cli_demo.py的时候 开始做模型量化

  1. gcc编译第一个kernel报错,缺少-lpthread,问题是命令上写的是-pthread,不知道是啥情况
  2. 编译第二个kernel不报错,但是无法加载编译出来的so就很奇怪
No compiled kernel found.
Compiling kernels : C:\Users\admin\.cache\huggingface\modules\transformers_modules\local\quantization_kernels_parallel.c
Compiling gcc -O3 -fPIC -pthread -fopenmp -std=c99 C:\Users\admin\.cache\huggingface\modules\transformers_modules\local\quantization_kernels_parallel.c -shared -o C:\Users\admin\.cache\huggingface\modules\transformers_modules\local\quantization_kernels_parallel.so
d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
Compile failed, using default cpu kernel code.
Compiling gcc -O3 -fPIC -std=c99 C:\Users\admin\.cache\huggingface\modules\transformers_modules\local\quantization_kernels.c -shared -o C:\Users\admin\.cache\huggingface\modules\transformers_modules\local\quantization_kernels.so
Kernels compiled : C:\Users\admin\.cache\huggingface\modules\transformers_modules\local\quantization_kernels.so
Cannot load cpu kernel, don't use quantized model on cpu.

Expected Behavior

希望其正常编译完成,并成功量化,不然小显存不太够 或者作者用的gcc是什么版本的?

Steps To Reproduce

cli_demo.py中加载的模型是这个

model = AutoModel.from_pretrained("./models/THUDM/chatglm-6b-int4-qe", trust_remote_code=True).half().cuda()

Environment

- OS:win10
- Python:3.9
- Transformers:4.26.1
- PyTorch:1.13.1+cu116
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :True
- gcc:6.3.0

Anything else?

No response

zyuerugou avatar Mar 25 '23 05:03 zyuerugou

可以尝试gcc 10.3.0?另外需要保证python和gcc都是64位的。

songxxzp avatar Mar 26 '23 11:03 songxxzp

多谢,问题在于gcc是32位的。。。

zyuerugou avatar Mar 26 '23 12:03 zyuerugou

多谢,问题在于gcc是32位的。。。

win10上怎么安装正64位的gcc

oiuv avatar Mar 27 '23 06:03 oiuv

安装mingww64

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2023年03月27日 14:58 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [THUDM/ChatGLM-6B] [BUG/Help]gcc编译第一个kernel报错,编译第二个成功,但是无法加载so (Issue #229) |

多谢,问题在于gcc是32位的。。。

win10上怎么安装正64位的gcc

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zyuerugou avatar Mar 27 '23 06:03 zyuerugou