Baichuan-13B icon indicating copy to clipboard operation
Baichuan-13B copied to clipboard

8bit量化加载后推理速度变慢

Open NLPerxue opened this issue 1 year ago • 6 comments

使用如下方式加载模型,但是推理速度变慢约1.5倍,且模型性能下降明显,是真么原因呢? tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_path, load_in_4bit=False, load_in_8bit=True, device_map='auto', max_memory={i: '24000MB' for i in range(torch.cuda.device_count())}, torch_dtype=torch.float32, trust_remote_code=True ).eval() model.generation_config = GenerationConfig.from_pretrained(model_path) # print(model.generation_config)

return tokenizer, model

NLPerxue avatar Aug 22 '23 05:08 NLPerxue

显卡配置:V100 32G显存

NLPerxue avatar Aug 22 '23 05:08 NLPerxue

遇到同样的问题,求答案。

量化后,除了显存占用降低,GPU使用率不会下降,基本都在100%,而推理速度有2倍以上的降低。

不符合预期。

tommyjex avatar Aug 22 '23 15:08 tommyjex

一样的问题,推理速度很慢。另外试图使用多线程跑点数据,显存飙升太厉害

linglingfengty avatar Aug 27 '23 13:08 linglingfengty

显卡配置:V100 32G显存

可以用nsight分析一些具体是哪里慢了

shiqingzhangCSU avatar Aug 31 '23 09:08 shiqingzhangCSU

同样的问题,输入3K,大概是1.5分钟,有没有大佬有法子?

QuanhuiGuan avatar Sep 15 '23 02:09 QuanhuiGuan

请问大家解决了吗?

jialiangwww avatar Sep 26 '24 07:09 jialiangwww