본문 바로가기

Engineering45

[에러] ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' pip install torch==1.4.0 ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' Torch 1.4.0 이후 버전에서 SAVE_STATE_WARNING 모듈이 삭제되어 발생한 오류 pip install torch==1.4.0 2023. 5. 12.
[에러] packaging.version.InvalidVersion: Invalid version: '0.10.1,<0.11' packaging.version.InvalidVersion: Invalid version: '0.10.1, 2023. 5. 12.
[에러] ModuleNotFoundError: No module named 'transformers.tokenization_bert' ModuleNotFoundError: No module named 'transformers.tokenization_bert' from transformers.tokenization_bert import BasicTokenizer ModuleNotFoundError: No module named 'transformers.tokenization_bert' transformers version을 2.9에서 4.27로 upgrade하니 위와 같은 에러 발생. 구글링하니, 4.0 이상의 버전에서 발생한다고 하여 3.5로 install 후 해결 pip install transformers==3.5 https://stackoverflow.com/questions/74005930/loss-does-not-decreas.. 2023. 5. 12.
[에러] OSError: Can't load config for 'klue/bert-base' OSError: Can't load config for 'klue/bert-base'. Make sure that: - 'klue/bert-base' is a correct model identifier listed on 'https://huggingface.co/models' - or 'klue/bert-base' is the correct path to a directory containing a config.json file 아래 늘 실행하던 간단한 코드를 실행하는데, 에러가 발생했다. from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("klue/bert-base") 혹시, transformers가 ver.. 2023. 5. 12.
[에러] AttributeError: module 'torch.distributed' has no attribute '_reduce_scatter_base' pip install torch==1.10 AttributeError: module 'torch.distributed' has no attribute '_reduce_scatter_base' python 파일을 실행하는데, 아래 부분에서 위의 에러가 났다. from transformers import ( MODEL_MAPPING, AutoConfig, AutoTokenizer, AutoModel, ) apex라는 패키지의 mapping.py에서 발생하는데, apex-0.1-py3.7.egg 파일 내에 있어서 쉽게 수정이 어려웠다. 구글링을 해보니, torch >=1.10 이어야 지원가능하다는 것 확인. https://github.com/hpcaitech/ColossalAI/issues/2673#issue.. 2023. 5. 12.
[Docker][NVIDIA] Failed to initialize NVML: Driver/library version mismatch 해결 서버 재부팅 하지않고, nvidia 프로시저 재시작으로 해결하는 방법 nvidia-smi docker에서 컨테이너를 --gpus all 옵션으로 실행하고자 하는데 아래 에러 발생 docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy' nvidia-container.. 2023. 4. 19.
[Python] 파이썬 파일, 경로 복사 shutil.copyfile, copy, copy2, copytree copyfile < copy < copy2 src dst 설명 shutil.copyfile 파일 파일, 폴더 shutil.copy 이전 버전 shutil.copy 파일 파일, 폴더 shutil.copy2 파일 파일, 폴더 shutil.copy + 메타정보까지 복사 shutil.copytree 폴더 폴더 폴더 통째로 복사 2023. 1. 19.
[Python] 파이썬 경로 제외한 파일명 반환 - os.path.basename(path) os.path.basename(path) : 상위 경로를 제외한 파일명만 반환 : "/"문자열 기준 split하여 가장 마지막 것을 반환한다고 생각하면 된다. (따라서, "/"로 끝나는 경우 빈값 반환) 1) path 가 폴더인 경우 : 폴더명 2) path 가 파일인 경우 : 파일명 import os path = "/d/workspace/dir1/dir2/dir3" print(f"[1] '{os.path.basename(path)}'") # [1] 'dir3' path = "/d/workspace/dir1/dir2" print(f"[2] '{os.path.basename(path)}'") # [2] 'dir2' path = "/d/workspace/dir1/dir2/" print(f"[3] '{os.p.. 2023. 1. 17.
[Python] 파이썬 파일 내 디렉토리 생성 - os.mkdir, os.makedirs 1. os.mkdir("file1") : 현재 위치의 경로에서 "file1" 생성 import os os.mkdir("file1") 2. os.makedirs("dir1/dir2/dir3/file1", exist_ok=True) - 지정한 경로 내 모든 (하위) 디렉토리 생성 - "exist_ok" : 모든 경로가 존재할 경우 에러 발생 FileExistError import os os.makedirs("dir1/dir2/dir3/file1", exist\_ok=True) 2023. 1. 17.
[Error][Git] error: src refspec master does not match any git add와 commit 후 push를 하려는데 아래와 같은 에러가 발생 error: src refspec master does not match any push하는 사용자가 누구인지 정의가 되지 않아서 발생한 오류로 확인 아래와 같이하여 해결됨 $ git config --global user.name hyen4110 $ git config --global user.email hyen4110@tistory.com $ git init $ git add . $ git commit -m "add faiss" $ git config --global user.name hyen4110 $ git config --global user.email hyen4110@tistory.com $ git push -u ori.. 2023. 1. 17.
[Error] A load persistent id instruction was encountered 딥러닝 모델 예측 파일 실행하는데 아래와 같은 에러가 발생 A load persistent id instruction was encountered but no persistent\_load function was specified. 살펴보니, .bin 파일을 pickle로 load해서 발생했음 (이전에 작성한 코드 줄을 지우지 않아서 발생) 지우고나서 정상적으로 작동함 확인 https://stackoverflow.com/questions/66337562/unpicklingerror-a-load-persistent-id-instruction-was-encountered-but-no-persis 2023. 1. 12.
[Docker][Error] bash: ifconfig: command not found docker 네트워크 관련하여 공부하는 중, $ docker pull centos $ docker run --gpus all --name centos_gpu centos $ ifconfig bash: ifconfig: command not found 가 발생하였다. ifconfig는 CentOS 6까지는 디폴트로 가능한 명령어였지만, CentOS 7부터는 디폴트가 아니라 설치해야 한다고 한다. 따라서, ifconfig 명령어가 포함된 net-tools package를 설치해야 한다. 그래서 yum install net-tools를 실행하였으나, 이것도 오류가 발생 $ yum install net-tools Failed to set locale, defaulting to C.UTF-8 CentOS Linu.. 2022. 12. 22.
[Docker] Docker Container 외부 노출하기 (PORT 바인딩) Docker Container 외부 노출하기 (HOST PORT 바인딩) 컨테이너는 가상머신과 마찬가지로 가상 IP주소를 할당 받는데, 기본적으로 도커는 컨테이너에 172.17.0.x의 IP를 순차적으로 할당합니다. 이는 컨테이너를 실행해서 ifconfig 명령어로 확인할 수 있습니다. 만일 아무런 설정을 하지 않았다면, 이 컨테이너는 외부에서 접근할 수 없으며 도커가 설치된 호스트에서만 접근할 수 있습니다. 따라서, 외부에 컨테이너를 노출하고 싶다면, IP와 포트를 호스트의 IP와 포트에 바인딩해야합니다. IP/PORT 연결 ✔ type#1 PORT만 바인딩 -p 옵션으로 호스트 80포트와 컨테이너 80포트를 연결 $ docker run -it --name mywebserver -p 80:80 cent.. 2022. 12. 21.
[Docker] Docker Container 실행 명령어 정리 Docker Container 관련 명령어 정리 ✔ Container 밖으로 나가기 $ exit 컨테이너를 나오면서 정지시킴 Ctrl+D Ctrl+P,Q 컨테이너를 나오면서 정지시키지 않음 ✔ Container 생성하기 $ docker create -it --name mycentos centos:7 컨테이너 생성하지만 내부로 들어가지는 않음 $ docker run-it --name mycentos centos:7 컨테이너 생성하며 내부로 들어감 ✔ Container 내부로 들어가기 $ docker run-it --name mycentos centos:7 컨테이너 생성하며 내부로 들어감 $ docker start mycentos $ docker attach mycentos ❓ docker "run" vs .. 2022. 12. 21.
[Docker][Error] CentOS 7 - File "/usr/bin/yum-config-manager", line 135 except yum.Errors.RepoError, e: 2022.12.21 - [Engineering/도커(Docker)] - [Docker] 리눅스 도커 엔진 설치 - CentOS 7 [Docker] 리눅스 도커 엔진 설치 - CentOS 7 리눅스 도커 엔진 설치 ✔ 설치 전 확인해야할 사항 호스트 운영체제 버전 : 최소 3.10 버전 이상 uname -r로 확인! 오래된 리눅스 배포판은 업데이트 지원 불가 : 지원 가능 배포판 (Ubuntu 14.04, 16.04, 1 hyen4110.tistory.com [리눅스 도커 엔진 설치 에러] CentOS 7 - File "/usr/bin/yum-config-manager", line 135 except yum.Errors.RepoError, e: CentOS 7 에서 아래 글과 같이 docker engine.. 2022. 12. 21.