[Bug] DeepSpeed Inference Does not Work with LLaMA (Latest verison)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python, pytorch
- Domain
- machine-learning
Research direction
Reproduce the failure with inference/huggingface/text-generation/inference-test.py and inspect text-generation/utils.py, then follow the DeepSpeed inference call in the engine traceback and Transformers' modeling_llama.py. Determine why the LLaMA generation path receives DeepSpeedGPTInference; done means the supplied command completes without the self_attn AttributeError and produces generated output.
Written by the indexing model from the issue text.
Description
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?
- Dominant language
- Python
- Stars
- 6.8k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deepspeedai/DeepSpeedExamples
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
deepspeedai/DeepSpeedExamples#996 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
deepspeedai/DeepSpeedExamples#995 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
deepspeedai/DeepSpeedExamples#989 ·
-
moe example 404 Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
deepspeedai/DeepSpeedExamples#984 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
deepspeedai/DeepSpeedExamples#979 · 6 comments ·
All issues in deepspeedai/DeepSpeedExamples
Similar issues
-
area: harness bug status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Human-Agent-Society/reef#625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
learningequality/kolibri#15351 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Name consistency Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eellak/triplestore#65 · 1 comment ·