Skip to content

[BUG] Pythia (GPT-NeoX based) models degrade in generation quality using DeepSpeed Inference #2855

Description

@tokestermw

Describe the bug
Hi, the GPT-NeoX based Pythia model's generation quality is degraded once optimized with DeepSpeed.

Edit (2023/03/07): related to #2777.

To Reproduce

from transformers import pipeline
import deepspeed
import torch

prompt = "As the final model release of GPT-2’s staged release, we’re releasing the largest version (1.5B parameters) of GPT-2 along with code and model weights to facilitate detection of outputs of GPT-2 models. While there have been larger language models released since August, we’ve continued with our original staged release plan in order to provide the community with a test case of a full staged release process. We hope that this test case will be useful to developers of future powerful models, and we’re actively continuing the conversation with the AI community on responsible publication."

gpt2_pipe = pipeline('text-generation', 'gpt2', device=0)
gpt2_pipe(prompt, max_new_tokens=50, return_full_text=False, do_sample=False)

# [{'generated_text': '\n\nWe are also pleased to announce that the GPT-2 model release is now available for download on the GPT-2 website.\n\nThe GPT-2 model release is available for download on the GPT-2 website.'}]

gpt2_pipe.model = deepspeed.init_inference(gpt2_pipe.model, replace_with_kernel_inject =True, replace_method='auto', dtype=torch.half, enable_cuda_graph=False)
gpt2_pipe(prompt, max_new_tokens=50, return_full_text=False, do_sample=False)

# [{'generated_text': '\n\nWe are also pleased to announce that the GPT-2 model release is now available for download on the GPT-2 website.\n\nThe GPT-2 model release is available for download on the GPT-2 website.'}]

pythia_pipe =  pipeline('text-generation', 'EleutherAI/pythia-125m-deduped', device=0)
pythia_pipe(prompt, max_new_tokens=50, return_full_text=False, do_sample=False)

# [{'generated_text': '\n\nWe’re also working on a new model release for GPT-2, which will be released in the next few weeks. We’re working on a new model release for GPT-2, which will be released in the next'}]

pythia_pipe.model = deepspeed.init_inference(pythia_pipe.model, replace_with_kernel_inject =True, replace_method='auto', dtype=torch.half, enable_cuda_graph=False)
pythia_pipe(prompt, max_new_tokens=50, return_full_text=False, do_sample=False)

# [{'generated_text': '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nof the GTS of the G. The GTS of the G. The G. The G. The G. The G. The G. The G. The'}]

Expected behavior
Get the same generation results w/ and w/o DeepSpeed for Pythia models.

ds_report output

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]  please install triton==1.0.0 if you want to use sparse attention
sparse_attn ............ [NO] ....... [NO]
spatial_inference ...... [NO] ....... [OKAY]
transformer ............ [NO] ....... [OKAY]
stochastic_transformer . [NO] ....... [OKAY]
transformer_inference .. [NO] ....... [OKAY]
utils .................. [NO] ....... [OKAY]
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/root/venv/lib/python3.7/site-packages/torch']
torch version .................... 1.13.1+cu117
deepspeed install path ........... ['/root/venv/lib/python3.7/site-packages/deepspeed']
deepspeed info ................... 0.8.1, unknown, unknown
torch cuda version ............... 11.7
torch hip version ................ None
nvcc version ..................... 11.7

System info (please complete the following information):

  • OS: Ubuntu 20.04
  • GPU count and types 1 A10G (AWS g5.xlarge)
  • transformers 4.26.1
  • Python version 3.7

Docker context
11.7.1-cudnn8-devel-ubuntu20.04

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions