DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

[BUG] Training crashes with "'Tensor' object has no attribute 'ds_id'"

Open oscarkey opened this issue 9 months ago • 0 comments

Describe the bug Setting both offload_optimizer.device = "nvme" and offload_param.device = "nvme" results in the following exception:

[rank0]: Traceback (most recent call last):
...
[rank0]:   File "/home/oscar/Documents/repos/pipelinedft/deepspeed_repro.py", line 67, in main
[rank0]:     trainer.train()
...
[rank0]:   File "/home/oscar/.cache/pypoetry/virtualenvs/pippysinglegpu-DD8dToGi-py3.11/lib/python3.11/site-packages/deepspeed/runtime/swap_tensor/optimizer_utils.py", line 441, in _create_param_swap_info
[rank0]:     param_id = OptimizerSwapper.parameter_id(parameter)
[rank0]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "/home/oscar/.cache/pypoetry/virtualenvs/pippysinglegpu-DD8dToGi-py3.11/lib/python3.11/site-packages/deepspeed/runtime/swap_tensor/optimizer_utils.py", line 117, in parameter_id
[rank0]:     return param.ds_id
[rank0]:            ^^^^^^^^^^^
[rank0]: AttributeError: 'Tensor' object has no attribute 'ds_id'

See full_logs.txt.

This already seems to have been fixed in https://github.com/microsoft/DeepSpeed/pull/5193, which is waiting to be reviewed.

To Reproduce See minimal_repro.txt. Setting both offload_optimizer.device = "nvme" and offload_param.device = "nvme" and then training triggers the bug.

Expected behavior No crash.

ds_report output

[2024-05-02 15:00:56,321] [INFO] [real_accelerator.py:203:get_accelerator] Setting ds_accelerator to cuda (auto detect)
 [WARNING]  Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH
 [WARNING]  sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.3
 [WARNING]  using untested triton version (2.3.0), only 1.0.0 is known to be compatible
WARNING:root:Setting PiPPy logging level to: WARNING
--------------------------------------------------
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]
fused_adam ............. [NO] ....... [OKAY]
cpu_adam ............... [NO] ....... [OKAY]
cpu_adagrad ............ [NO] ....... [OKAY]
cpu_lion ............... [NO] ....... [OKAY]
 [WARNING]  Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH
evoformer_attn ......... [NO] ....... [NO]
fp_quantizer ........... [NO] ....... [OKAY]
fused_lamb ............. [NO] ....... [OKAY]
fused_lion ............. [NO] ....... [OKAY]
inference_core_ops ..... [NO] ....... [OKAY]
cutlass_ops ............ [NO] ....... [OKAY]
transformer_inference .. [NO] ....... [OKAY]
quantizer .............. [NO] ....... [OKAY]
ragged_device_ops ...... [NO] ....... [OKAY]
ragged_ops ............. [NO] ....... [OKAY]
random_ltd ............. [NO] ....... [OKAY]
 [WARNING]  sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.3
 [WARNING]  using untested triton version (2.3.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]
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/home/oscar/.cache/pypoetry/virtualenvs/pippysinglegpu-DD8dToGi-py3.11/lib/python3.11/site-packages/torch']
torch version .................... 2.3.0+cu121
deepspeed install path ........... ['/home/oscar/.cache/pypoetry/virtualenvs/pippysinglegpu-DD8dToGi-py3.11/lib/python3.11/site-packages/deepspeed']
deepspeed info ................... 0.14.2, unknown, unknown
torch cuda version ............... 12.1
torch hip version ................ None
nvcc version ..................... 12.4
deepspeed wheel compiled w. ...... torch 0.0, cuda 0.0
shared memory (/dev/shm) size .... 62.82 GB

System info (please complete the following information):

  • OS: Arch Linux
  • GPU count and types: 1 machine with 1 nvidia 3090
  • Python version: Python 3.11.8
  • Any other relevant info about your setup:

Launcher context With the Python script provided above.

oscarkey avatar May 02 '24 16:05 oscarkey