Deepspeed 에서 GPU 를 잘못 사용할 때 해결법

2024. 12. 1. 16:48 · Python 및 Torch 코딩 이모저모

나는 os.environ["CUDA_VISIBLE_DEVICES"] = '2,3’ 인데

 

🚫 RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu

 

위 에러는 gpu 를 0 번 쓰고 근데 그거도 모자라서 cpu 사용한다고 되어있음.

 

** 찾아보니 : https://github.com/microsoft/DeepSpeed/issues/3070

 

[BUG] cannot set gpu 2,3 to train with deepspeed and trainer in huggingface · Issue #3070 · microsoft/DeepSpeed

Describe the bug A clear and concise description of what the bug is. To Reproduce Steps to reproduce the behavior: Go to '...' Click on '....' Scroll down to '....' See error Expected behavior A cl...

github.com

 

아래와 같이 DeepSpeed launcher (터미널에서 deepspeed 명령어를 사용하여 실행) 를 사용하면 CUDA_VISIBLE_DEVICES 를 사용해봣자 의미가 없다고 한다.

자동으로 gpu 0, 1 부터 사용한다.

 

deepspeed --num_nodes=1 --num_gpus=2 dscoder_train.py --deepspeed config_deepspeed.json

​

https://github.com/microsoft/DeepSpeed/issues/3070

 

위의 깃허브 이슈에서 시키는 대로 해보면,

 

 deepspeed --num_nodes=1 --num_gpus=2 --include localhost:2,3 dscoder_train.py --deepspeed config_deepspeed.json

 

이런식으로 사용하면 아래와 같은 에러가 뜬다.

 

🚫 ValueError: Cannot specify num_nodes/gpus with include/exclude

 

그래서 --num_nodes 와--num_gpus 빼고 쓰면 워하는 gpu 의 메모리를 사용하는 것을 알 수 있다.

 

 

'Python 및 Torch 코딩 이모저모' 카테고리의 다른 글

device-side assert triggered error  (0) 2024.11.26
RuntimeError: The server socket has failed to listen on any local network address.  (1) 2024.11.20
HuggingFace login 에러  (0) 2024.11.17
git 사용법 5  (0) 2024.11.15
git 이용법 4  (0) 2024.11.14
'Python 및 Torch 코딩 이모저모' 카테고리의 다른 글
  • device-side assert triggered error
  • RuntimeError: The server socket has failed to listen on any local network address.
  • HuggingFace login 에러
  • git 사용법 5
섬섬옥수수
섬섬옥수수
컴공 AI 개발자가 되기 위한 노역입니다
아날로그 인간의 컴공 되기컴공 AI 개발자가 되기 위한 노역입니다
섬섬옥수수
아날로그 인간의 컴공 되기
섬섬옥수수
전체
오늘
어제
  • 분류 전체보기
    • 백준 단계별 코딩 테스트
    • KB 논문 정리
    • Memory network 논문 정리
    • LLM 관련 논문 정리
    • Python 및 Torch 코딩 이모저모
    • Clustering 관련 논문 정리
    • 머신러닝 이모저모
    • 암호학

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • eeve
  • 소프트웨어
  • 심재형
  • 이화여대
  • 하드웨어
  • 티스토리챌린지
  • GIT
  • 백준
  • constituency tree
  • 인공지능융합기반시스템개론
  • dependency tree
  • vocabulary expansion
  • 문제풀이
  • PEFT
  • 코딩테스트
  • 오블완
  • huggingface-cli login
  • huggingface oserror
  • CUDA
  • efficient and effective vocabulary expansion towards multilingual large language models

최근 댓글

최근 글

hELLO · Designed By 정상우.v4.2.0
섬섬옥수수
Deepspeed 에서 GPU 를 잘못 사용할 때 해결법
상단으로

티스토리툴바

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.