deepspeedai / deepspeedai/DeepSpeed

[BUG]

Open
#4,841 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
As shown in this notebook, I run these commands:
The language model I utilize is Qwen-14B, developed by Alibaba Cloud, which is a robust Transformer-based model. The software I employ is PyCharm 2023.3.1 version. Here are the encountered errors.

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting deepspeed
  Using cached https://mirrors.aliyun.com/pypi/packages/3b/c7/c962c7515511ee4f6fe092506e303ef6973c58cfa18ff7edcebb455261b5/deepspeed-0.12.5.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      [WARNING] Unable to import torch, pre-compiling ops will be disabled. Please visit https://pytorch.org/ to see how to properly install torch on your system.
       [WARNING]  unable to import torch, please install it if you want to pre-compile any deepspeed ops.
      DS_BUILD_OPS=1
      Traceback (most recent call last):
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 147, in <module>
      AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.


The current state of my environment and version.

Python 3.8.0
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Wed_Feb__8_05:53:42_Coordinated_Universal_Time_2023
Cuda compilation tools, release 12.1, V12.1.66
Build cuda_12.1.r12.1/compiler.32415258_0
Name: torch
Version: 2.1.2+cu121
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: c:\users\admin\appdata\local\programs\python\python38\lib\site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions
Required-by: torchaudio, torchvision

The error encountered during DeepSpeed installation suggests that PyTorch is not found prior to building the wheel (compiling the extension). This typically indicates either an incorrect or incompatible version of PyTorch installed in the Python environment.

The first thing I did was to promptly verify the PyTorch version and the CUDA version.

PyTorch version 2.1.2, compiled for CUDA 12.1,

The issue may arise from a potential discrepancy between the PyTorch version required by DeepSpeed and the version you have installed.

The code I use incorporates a variable version, making DeepSpeed adaptable to different versions of PyTorch or CUDA. To install DeepSpeed, I follow the standard method that is compatible with my existing PyTorch installation (specifically, CUDA 12.1 based PyTorch). Typically, DeepSpeed installations are done using pip.
The code to be utilized is:

The outcome remains consistent with the error.

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting deepspeed
  Using cached https://mirrors.aliyun.com/pypi/packages/3b/c7/c962c7515511ee4f6fe092506e303ef6973c58cfa18ff7edcebb455261b5/deepspeed-0.12.5.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      [WARNING] Unable to import torch, pre-compiling ops will be disabled. Please visit https://pytorch.org/ to see how to properly install torch on your system.
       [WARNING]  unable to import torch, please install it if you want to pre-compile any deepspeed ops.
      DS_BUILD_OPS=1
      Traceback (most recent call last):
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 147, in <module>
      AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.


The conclusion remains incorrect, and there arises an issue in constructing DeepSpeed's wheel file due to the requirement of precompiling certain operations by PyTorchTo, which seems undetectable by the system.

The code is re-executed in the controller.

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
2.1.2+cu121
>>> 

"This indicates that I have successfully verified the presence of PyTorch version 2.1.2 in my current Python environment, and it has been compiled specifically for CUDA 12.1. Despite utilizing CUDA 12.1, I am still encountering errors."

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 by reproducing the reported pip install deepspeed failure in the stated Python 3.8, PyTorch 2.1.2+cu121, and CUDA 12.1 environment. Trace the package build path that enables DS_BUILD_OPS and compare its torch detection with the successful interactive import torch. Done means the installation behavior is explained and the issue has a verified fix or a clearly documented supported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.