AI TECH/TIL

STS 대회 에러 해결법

prefer_all 2022. 11. 2. 15:08

1. 온갖 github 에러의 원인은 프로젝트 내 폴더가 중첩된 구조일 때 git init을 상, 하위 폴더에서 전부 했기 때문이었다.

 

.git
📁 folder1/
📁 folder2/
즉 이렇게 되어야 하는데 아래(문제)처럼 했다

.git
📁 folder1/
ㄴ. git
📁 folder2/
ㄴ .git

 

 

2. 그리고 vscode에 github을 연결할 때 conflict가 나지 않게 웬만하면 pull을 해오고 이후에 수정하는 게 좋겠다.

$ git init

$ git remote add <remote> [GITHUB_LINK]
# ex) git remote add origin [GITHUB_LINK]

$ git remote -v # 잘 연결됐나 확인

$ git pull <remote> <branch>
# ex) git pull origin main

만약에 pull을 깜빡하고 push를 해서 fatal: refusing to merge unrelated histories 오류가 뜨면

$ git pull origin master --allow-unrelated-histories

 

이제 원래 하던대로

$ git add .
$ git commit -m "<message>"
$ git push <remote> <branch>

 

+ 특정 branch만 clone하는 법

git clone -b {branch_name} --single-branch {저장소 URL}

error: src refspec <remote> does not match any.

 


RuntimeError: CUDA out of memory.

=> 원인: batch size가 너무 크거나, 코드 상에서 메모리 누수가 발생했기 때문 해결: batch size 크기를 줄여가면서 gpu 캐시를 비워주는 아래 코드를 실행

import gc
import torch

gc.collect()
torch.cuda.empty_cache()

나의 경우는 batchsize가 너무 커서 발생한 문제였다.


ImportError: IProgress not found

=> 원인: ipywidgets 을 업그레이드 하라는 것

pip install ipywidgets

jupyter nbextension enable --py widgetsnbextension

FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

df = df.append(more) => df = pd.concat([df, more])

Segmentation fault (core dumped)

 

짜증나서 그냥 서버를 삭제하고 새로 만들었었다. 나중에야 원인과 해결책을 알았다.

 

=> 원인: torch와 torchvision version 이 호환되지 않을 때 위 에러가 뜰 수 있다.

print(torch.__version__)

우선 torch의 버전을 확인한다. 만약, torch 버전이 cuda를 호환하지 않는다면 torch를 재설치해야 한다.

 pip uninstall torchvision

 

+ 슬랙 질의 응답에서 나온 답 

pip 패키지 dependency가 꼬일 지 모르니 조심 ...

pip install -U --force-reinstall --no-deps protobuf==3.19.6
pip install -U --force-reinstall --no-deps protobuf==3.9.2

 

 

'AI TECH > TIL' 카테고리의 다른 글

[TIL] AI와 저작권법  (0) 2022.11.10
Contrastive Learning  (0) 2022.11.03
Wandb Sweep  (0) 2022.11.02
[P stage] Week6 Today I Learn  (0) 2022.11.02
[실습] Week5 Today I Learn  (0) 2022.10.21