ChatGLM3 icon indicating copy to clipboard operation
ChatGLM3 copied to clipboard

AssertionError: The weights that need to be quantified should be on the CUDA device

Open SteveYung-tech opened this issue 2 years ago • 1 comments

System Info / 系統信息

Setting eos_token is not supported, use the default one. Setting pad_token is not supported, use the default one. Setting unk_token is not supported, use the default one. Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████| 7/7 [00:07<00:00, 1.07s/it] Symbol cudaLaunchKernel not found in C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\cudart64_65.dll 2024-03-29 00:39:29.792 Uncaught app exception Traceback (most recent call last): File "D:\webui_ui\py310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 542, in _run_script exec(code, module.dict) File "D:\ChatGLM3\composite_demo\main.py", line 10, in import demo_chat, demo_ci, demo_tool File "D:\ChatGLM3\composite_demo\demo_chat.py", line 7, in client = get_client() File "D:\webui_ui\py310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 210, in wrapper return cached_func(*args, **kwargs) File "D:\webui_ui\py310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 239, in call return self._get_or_create_cached_value(args, kwargs) File "D:\webui_ui\py310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 266, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "D:\webui_ui\py310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 322, in _handle_cache_miss computed_value = self._info.func(*func_args, **func_kwargs) File "D:\ChatGLM3\composite_demo\client.py", line 26, in get_client client = HFClient(MODEL_PATH, TOKENIZER_PATH, PT_PATH) File "D:\ChatGLM3\composite_demo\client.py", line 149, in init self.model = AutoModel.from_pretrained(MODEL_PATH, trust_remote_code=True).quantize(4).cuda().eval() File "C:\Users\ZYFF.cache\huggingface\modules\transformers_modules\THUDM\chatglm3-6b\a5ba5501eb873d40d48bd0983bd2a8dd006bb838\modeling_chatglm.py", line 1212, in quantize self.transformer.encoder = quantize(self.transformer.encoder, bits, empty_init=empty_init, device=device, File "C:\Users\ZYFF.cache\huggingface\modules\transformers_modules\THUDM\chatglm3-6b\a5ba5501eb873d40d48bd0983bd2a8dd006bb838\quantization.py", line 156, in quantize layer.self_attention.query_key_value = QuantizedLinear( File "C:\Users\ZYFF.cache\huggingface\modules\transformers_modules\THUDM\chatglm3-6b\a5ba5501eb873d40d48bd0983bd2a8dd006bb838\quantization.py", line 128, in init assert str(weight.device).startswith('cuda'), 'The weights that need to be quantified should be on the CUDA device' AssertionError: The weights that need to be quantified should be on the CUDA device

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • [ ] The official example scripts / 官方的示例脚本
  • [ ] My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

1.按照教程修改 self.model = AutoModel.from_pretrained(MODEL_PATH, trust_remote_code=True).quantize(4).cuda().eval() 2.运行命令composite_demo 中的main.py

Expected behavior / 期待表现

希望能告知具体的解决方法

SteveYung-tech avatar Mar 28 '24 16:03 SteveYung-tech

@SteveYung-tech self.model = AutoModel.from_pretrained(MODEL_PATH, trust_remote_code=True).cuda().quantize(4).eval()

xiaokening avatar Mar 29 '24 02:03 xiaokening