DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

[BUG] Getting .half() is not supported when using QLora

Open abdulvirta opened this issue 3 years ago • 3 comments

Describe the bug When trying to train large language models using QLora which loads the model in 4-bit, deepspeed initialization fail with this error:

File "/root/.pyenv/versions/3.10.11/envs/dagster_venv/lib/python3.10/site-packages/deepspeed/init.py", line 165, in initialize engine = DeepSpeedEngine(args=args, File "/root/.pyenv/versions/3.10.11/envs/dagster_venv/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 267, in init self._configure_distributed_model(model) File "/root/.pyenv/versions/3.10.11/envs/dagster_venv/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 1039, in _configure_distributed_model self.module.half() File "/root/.pyenv/versions/3.10.11/envs/dagster_venv/lib/python3.10/site-packages/transformers/modeling_utils.py", line 1907, in half raise ValueError( ValueError: .half() is not supported for 4-bit or 8-bit models. Please use the model as it is, since the model has already been casted to the correct dtype.

To Reproduce Steps to reproduce the behavior: Train a large language model with QLora config

Expected behavior The code should recognize that this model is using 4-bit and not try to perform .half()

ds_report output 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

[WARNING] async_io requires the dev libaio .so object and headers but these were not found. [WARNING] async_io: please install the libaio-dev package with apt [WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found. async_io ............... [NO] ....... [NO] 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.0 [WARNING] using untested triton version (2.0.0), 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] utils .................. [NO] ....... [OKAY]

DeepSpeed general environment info: torch install path ............... ['/root/.pyenv/versions/3.10.11/envs/dagster_venv/lib/python3.10/site-packages/torch'] torch version .................... 2.0.0+cu118 deepspeed install path ........... ['/root/.pyenv/versions/3.10.11/envs/dagster_venv/lib/python3.10/site-packages/deepspeed'] deepspeed info ................... 0.9.3, unknown, unknown torch cuda version ............... 11.8 torch hip version ................ None nvcc version ..................... 11.8 deepspeed wheel compiled w. ...... torch 2.0, cuda 11.8

Screenshots If applicable, add screenshots to help explain your problem.

System info (please complete the following information):

  • OS: Ubuntu 18.04
  • GPU count and types: one machine with x4 A100 80GBs
  • Interconnects N/A
  • Python version 3.10
  • Any other relevant info about your setup

Launcher context Are you launching your experiment with the deepspeed launcher, MPI, or something else? deepspeed launcher

Docker context Are you using a specific docker image that you can share? N/A

Additional context Add any other context about the problem here.

abdulvirta avatar Jun 08 '23 23:06 abdulvirta

I have the same issue. When will deepspeed support 4 bit training?

alibabadoufu avatar Jun 13 '23 02:06 alibabadoufu

any update on the issue so far?

spring1915 avatar Dec 09 '23 16:12 spring1915

So no plans for supporting QLoRA ?

gotzmann avatar Jan 28 '24 16:01 gotzmann