deepspeedai / deepspeedai/DeepSpeed

[BUG] OPT-66B fails to find layer weights

Open
#3,871 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug inference
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Describe the bug

Cannot find layer weights when loading/running OPT-66B using DeepSpeedExamples inference-test.py script.

KeyError: 'model.decoder.layers.47.self_attn.k_proj.weight'

Note: the specific layer number changes for different runs. I have confirmed this (and other) layers have been downloaded:

$ cat pytorch_model.bin.index.json | grep model.decoder.layers.47.self_attn.k_proj.weight
    "model.decoder.layers.47.self_attn.k_proj.weight": "pytorch_model-00010-of-00014.bin",
$ ls pytorch_model-00010-of-00014.bin
pytorch_model-00010-of-00014.bin

To Reproduce

git clone https://github.com/microsoft/DeepSpeedExamples.git
cd DeepSpeedExamples/inference/huggingface/text-generation
deepspeed --num_gpus 8 inference-test.py --name facebook/opt-66b --ds_inference --use_meta_tensor --use_kernel

Expected behavior
The inference model should run. Note that other models like OPT-30B, BLOOM-7b1, and GPT-NeoX-20B work normally. Not sure why only OPT-66B fails.

ds_report output

[2023-07-04 14:36:10,475] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
--------------------------------------------------
DeepSpeed C++/CUDA extension op report
--------------------------------------------------
NOTE: Ops not installed will be just-in-time (JIT) compiled at
      runtime if needed. Op compatibility means that your system
      meet the required dependencies to JIT install the op.
--------------------------------------------------
JIT compiled ops requires ninja
ninja .................. [OKAY]
--------------------------------------------------
op name ................ installed .. compatible
--------------------------------------------------
async_io ............... [NO] ....... [OKAY]
cpu_adagrad ............ [NO] ....... [OKAY]
cpu_adam ............... [NO] ....... [OKAY]
fused_adam ............. [NO] ....... [OKAY]
fused_lamb ............. [NO] ....... [OKAY]
quantizer .............. [NO] ....... [OKAY]
random_ltd ............. [NO] ....... [OKAY]
 [WARNING]  sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.1
 [WARNING]  using untested triton version (2.1.0+440fd1bf20), only 1.0.0 is known to be compatible
sparse_attn ............ [NO] ....... [NO]
spatial_inference ...... [NO] ....... [OKAY]
transformer ............ [NO] ....... [OKAY]
stochastic_transformer . [NO] ....... [OKAY]
transformer_inference .. [NO] ....... [OKAY]
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/data0/pratyush/miniconda3/envs/ds/lib/python3.8/site-packages/torch']
torch version .................... 2.1.0.dev20230703+cu121
deepspeed install path ........... ['/data0/pratyush/miniconda3/envs/ds/lib/python3.8/site-packages/deepspeed']
deepspeed info ................... 0.9.5, unknown, unknown
torch cuda version ............... 12.1
torch hip version ................ None
nvcc version ..................... 12.0
deepspeed wheel compiled w. ...... torch 0.0, cuda 0.0

System info (please complete the following information):

  • OS: Ubuntu 22.04
  • GPU count: tried on both 8xA100 and 8xH100 machines
  • Transformers version: 4.30.2
  • Python: 3.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DeepSpeedExamples/inference/huggingface/text-generation/inference-test.py and reproduce the OPT-66B command with --ds_inference, --use_meta_tensor, and --use_kernel. Inspect how pytorch_model.bin.index.json and the sharded files are loaded for the missing key, then compare the path used by working OPT-30B, BLOOM-7b1, or GPT-NeoX-20B runs. Done means OPT-66B inference runs successfully without the KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.