[Bug] DeepSpeed Inference Does not Work with LLaMA (Latest verison)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python, pytorch
调研方向
使用 inference/huggingface/text-generation/inference-test.py 重现该失败,并检查 text-generation/utils.py,然后跟踪 engine traceback 中的 DeepSpeed 推理调用以及 Transformers' modeling_llama.py。确定 LLaMA 生成路径为何会接收 DeepSpeedGPTInference;完成标准是所提供的命令在没有 self_attn AttributeError 的情况下完成,并产生生成的输出。
由索引模型根据 Issue 内容生成。
描述
Version
deepspeed: 0.13.4
transformers: 4.38.1
Python: 3.10
Pytorch: 2.1.2+cu121
CUDA: 12.1
Error in Example (To reproduce)
Just simply run this script
https://github.com/microsoft/DeepSpeedExamples/blob/master/inference/huggingface/text-generation/inference-test.py
deepspeed --num_gpus 8 inference-test.py --model meta-llama/Llama-2-7b-hf --use-kernel
It will show the following error:
Traceback (most recent call last):
File "/root/DeepSpeedExamples/inference/huggingface/text-generation/inference-test.py", line 82, in <module>
outputs = pipe(inputs,
File "/root/DeepSpeedExamples/inference/huggingface/text-generation/utils.py", line 71, in __call__
outputs = self.generate_outputs(input_list, num_tokens=num_tokens, do_sample=do_sample)
File "/root/DeepSpeedExamples/inference/huggingface/text-generation/utils.py", line 119, in generate_outputs
outputs = self.model.generate(input_tokens.input_ids, **generate_kwargs)
File "/miniconda/envs/py310/lib/python3.10/site-packages/deepspeed/inference/engine.py", line 636, in _generate
return self.module.generate(*inputs, **kwargs)
File "/miniconda/envs/py310/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/miniconda/envs/py310/lib/python3.10/site-packages/transformers/generation/utils.py", line 1592, in generate
return self.sample(
File "/miniconda/envs/py310/lib/python3.10/site-packages/transformers/generation/utils.py", line 2693, in sample
model_inputs = self.prepare_inputs_for_generation(input_ids, **model_kwargs)
File "/miniconda/envs/py310/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py", line 1256, in prepare_inputs_for_generation
if past_key_value := getattr(self.model.layers[0].self_attn, "past_key_value", None):
File "/miniconda/envs/py310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1695, in __getattr__
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'DeepSpeedGPTInference' object has no attribute 'self_attn'
Potential bug?
I suspect it did not find the right inference engine?, which should be DeepSpeedLlamaInference but not DeepSpeedGPTInference?
- 主要语言
- Python
- 星标
- 6.8k
- 派生
- 1.1k
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
deepspeedai/DeepSpeedExamples 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 52/100
deepspeedai/DeepSpeedExamples#996 ·
-
难度 4/5 3-5 天 新手友好度 25/100
deepspeedai/DeepSpeedExamples#995 ·
-
难度 2/5 1-3 小时 新手友好度 52/100
deepspeedai/DeepSpeedExamples#989 ·
-
moe example 404 未关闭
难度 4/5 3-5 天 新手友好度 25/100
deepspeedai/DeepSpeedExamples#984 ·
-
难度 4/5 3-5 天 新手友好度 42/100
deepspeedai/DeepSpeedExamples#979 · 6 条评论 ·
查看 deepspeedai/DeepSpeedExamples 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100