AutoGPTQ TypeError: forward() 缺少一个必需的位置参数:'hidden_states'[BUG] ?

wnrlj8wa  于 5个月前  发布在  其他
关注(0)|答案(3)|浏览(73)

Bug描述

当我们尝试将一个微调过的gpt-j模型转换为gptq时,会出现以下错误:
TypeError: forward()缺少1个必需的位置参数:'hidden_states'

硬件详情

A40

软件版本

nvcc --version
nvcc: NVIDIA (R) Cuda编译器驱动程序
版权所有 (c) 2005-2022 NVIDIA公司
创建于Wed_Sep_21_10:33:58_PDT_2022
CUDA编译工具,版本11.8,V11.8.89
构建cuda_11.8.r11.8/compiler.31833905_0
NVIDIA-SMI 535.161.08驱动程序版本:535.161.08 CUDA版本:12.2
有什么建议吗?

brccelvz

brccelvz1#

请尝试以下步骤:

  1. 使用最新版本的4.39.3(最新)转换器或4.38.2(稳定)版本。
  2. 从仓库中使用git clone命令安装autogtq。
lskq00tm

lskq00tm2#

nope:
python convert-to-gptq.py -m ./gpt-cmd -o ./gpt-cmd-gptq
CUDA extension not installed.
CUDA extension not installed.
/home/silvacarl/.local/lib/python3.8/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
return self.fget.get(instance, owner)()
Quantizing transformer.h blocks : 0%| | 0/28 [00:00<?, ?it/s]
Traceback (most recent call last):
File "convert-to-gptq.py", line 33, in
quantized_model = quantizer.quantize_model(model, tokenizer)
File "/home/silvacarl/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/silvacarl/.local/lib/python3.8/site-packages/optimum/gptq/quantizer.py", line 505, in quantize_model
block(*layer_inputs[j], **layer_input_kwargs[j])
File "/home/silvacarl/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/silvacarl/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
TypeError: forward() missing 1 required positional argument: 'hidden_states'
will try to build the Docker.

irtuqstp

irtuqstp3#

Dockerfile似乎过时了?请尝试以下错误:

$ docker build --no-cache --force-rm -t autogptq .

### => ERROR [9/9] RUN pip install -vvv . 1.9s

[9/9] RUN pip install -vvv .:
 0.481 Using pip 24.0 from /root/miniconda3/lib/python3.12/site-packages/pip (python 3.12)
 0.481 Non-user install because site-packages writeable
 0.520 Creating temporary directory: /tmp/pip-build-tracker-bbwhjl64
 0.520 Initialized build tracking at /tmp/pip-build-tracker-bbwhjl64
 0.520 Created build tracker: /tmp/pip-build-tracker-bbwhjl64
 0.520 Entered build tracker: /tmp/pip-build-tracker-bbwhjl64
 0.520 Created temporary directory: /tmp/pip-install-w4zqf4xa
 0.521 Created temporary directory: /tmp/pip-ephem-wheel-cache-exns5lav
 0.551 Processing /AutoGPTQ
 0.551 Added file:///AutoGPTQ to build tracker '/tmp/pip-build-tracker-bbwhjl64'
 0.551 Running setup.py (path:/AutoGPTQ/setup.py) egg_info for package from file:///AutoGPTQ
 0.552 Created temporary directory: /tmp/pip-pip-egg-info-tnc1zga1
 0.552 Preparing metadata (setup.py): started
 0.552 Running command python setup.py egg_info
 1.539 Traceback (most recent call last):
 1.540 File "", line 2, in 
 1.540 In file "/AutoGPTQ/setup.py", line 111, in local_arch_list = detect_local_sm_architectures()
 1.540 IndexError: list index out of range

这是一个Python包安装失败的错误信息。错误发生在尝试安装名为AutoGPTQ的Python包时,pip在生成元数据时失败了。这可能是由于网络问题、权限问题或者包本身的问题导致的。你可以尝试以下方法解决这个问题:

  1. 检查你的网络连接是否正常。
  2. 确保你有足够的权限来安装这个包。
  3. 尝试使用管理员权限运行命令。
  4. 如果可能的话,尝试从其他源安装这个包。

相关问题