본문 바로가기
오류

두근두근 kakaobrain pororo 라이브러리 설치 대모험

by 가장따뜻한로봇 2023. 4. 28.

 

자연어 처리와 음성 관련 태스크를 쉽게 수행할 수 있도록 도와주는 라이브러리 pororo 입니다.

자연어 처리 및 음성 분야 내 다양한 서브 태스크들을 태스크명을 입력하는 것만으로 쉽게 해결할 수 있습니다.

PORORO: Platform Of neuRal mOdels for natuRal language prOcessing

https://github.com/kakaobrain/pororo

 

 

 

한글 ocr 이 잘된다고 해서 pororo 를 사용해보고자 했지만... 

설치 오류가 너무 많았다.

 

필수 조건

python 3.6 / torch 1.6.0 ( cuda 10.1)  / torchivision==0.7.0 환경 필요

 

파이썬 3.6 이 필요하므로 가상환경 생성

conda create -n pororo python=3.6

(바로 pororo 설치 시  pororo 0.4.2 depends on torch==1.6.0 라고 뜸)

 

파이토치 1.6 버전이 필요하여서 

pip install torch==1.6.0 을 하면 버전이 없다고 뜸 ( 이름이 다른거 같음)

 

파이토치 한국 사용자 모임에서 이전 버전 참조

https://pytorch.kr/get-started/previous-versions/

파이토치 1.6.0 이고 cuda 10.1 설치

(콘다로 설치하니 뒤에 나오는 fairseq 설치하면 파이토치가 1.10.0 버전으로 다시 설치가 되어서 pororo 가 설치가 안됨)

# conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch # 콘다로 설치하니깐 안됨
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

이후 pororo 설치

pip install pororo

하지만 필요한 다른 라이브러리 설치 중 오류가 뜸 

하나씩 확인해 보니 fairseq 가 설치가 안됨. ( 이거 찾느라고 엄청 오래 걸림....)

필요한 버전은 fairseq == 0.10.2

 

pip 이용해서 설치가 안되는 오류가 있음 

=> 구글링을 하니 git hub 에 올라와 있는 fairseq 을 로컬로 복사 후 설치하면 된다고 함

git clone https://github.com/facebookresearch/fairseq
git reset --hard 83e615d66905b8ca7483122a37da1a85f13f4b8e # 0.10.2 버전으로 변경
cd fairseq
pip install -e .

필요한 버전이 0.10.2 버전이므로 맞는 버전을 설치 -> 잘됨

 

다시 pororo 설치 중 tokenizer 가 설치가 안됨 

error: Can not find Rust compiler

ERROR: Could not build wheels for tokenizers which use PEP517 and cannot be installed directly

 

=> Rust compiler가 필요하다고함

https://www.rust-lang.org/tools/install 에서 운영체제에 맞는 64비트로 설치

 

설치 후 pororo 설치 하니 잘 설치 됨

 

해결 완료

 

 

정리 

conda create -n pororo_test python=3.6 # 가상환경 생성
# torch 1.6.0 , cuda 10.1 , torchvision 0.7.0 설치
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html 

# fairseq 0.10.2 버전 설치
git clone https://github.com/facebookresearch/fairseq
cd fairseq
git reset --hard 83e615d66905b8ca7483122a37da1a85f13f4b8e
pip install -e .

pip install pororo

# pororo 설치 중 tokenizer 설치 실패 -> rust compiler 필요 시
# https://www.rust-lang.org/tools/install 에서 rustup 설치

 

 

ps. 이후 ocr 에 필요한 cv2 버전 맞춰서 설치 함.

pip install opencv-contrib-python==3.4.1.15
pip install --user scikit-image

해결하고 보니 간단한데 막상 그 상황이 되니....