본문 바로가기

카테고리 없음

EDGE 돌려보기

https://github.com/Stanford-TML/EDGE?tab=readme-ov-file

 

GitHub - Stanford-TML/EDGE: Official PyTorch Implementation of EDGE (CVPR 2023)

Official PyTorch Implementation of EDGE (CVPR 2023) - Stanford-TML/EDGE

github.com

 

 

환경

 

cuda: 11.3

 

EDGE-Env 

  python 3.9   (pytorch3d 설치하려면 3.7은 안됨, jukemirlib에서 no.egg-info 에러가 나서 3.8도 안됨...)

 

1. pytorch 1.12.1  설치

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

 

2. jukemirlib 설치

https://github.com/rodrigo-castellon/jukemirlib

 

GitHub - rodrigo-castellon/jukemirlib: A simple library for extracting representations from Jukebox

A simple library for extracting representations from Jukebox - rodrigo-castellon/jukemirlib

github.com

 

pip install git+https://github.com/rodrigo-castellon/jukemirlib.git

 

3. pytorch3d 설치

conda install -c bottler nvidiacub

위 명령어가 안먹혀서

직접 파일 다운로드 받고 압축을 풀어줬다. 패스 설정은 따로 하지 않았다. 버전은 cuda 11.3용인 1.10.0으로 ...

 

필요한 라이브러리들 설치

# Demos and examples
conda install jupyter
pip install scikit-image matplotlib imageio plotly opencv-python

# Tests/Linting
pip install black usort flake8 flake8-bugbear flake8-comprehensions

 

github을 통해서 인스톨하기

pip install "git+https://github.com/facebookresearch/pytorch3d.git"

 

잘 되었나 테스트해보기

https://github.com/facebookresearch/pytorch3d/blob/main/docs/tutorials/render_textured_meshes.ipynb

를 가지고 테스트 해본다.

 

VSCODE에서 jupyter 세팅을 해주고 진행해보니

matplotlib이 없다고 해서 설치해준다. 

plotly도 설치해준다.

 

wget으로 plot_image_grid.py를 다운받는 과정은 수동으로 처리해준다. 

3d모델 다운받는 과정도 수동으로 처리

 

이후 쭉 진행해서 렌더 잘되는것까지 확인해서 pytorch3d 설치 완료를 검증했다. 

 

4. accelerate 설치

 

pip install accelerate

accelerate config 를 해보니 

chardet이 없다고 한다. pip로 설치해준다. 

그 뒤에 config를 하면

요런식으로 나오는데 다 No로 선택했고, fp16으로 설정해줬다.

 

5. wine 설치

이건 리눅스에서 윈도우 프로그램 돌릴때 필요한거라 설치하지 않았다.

 

 

6. clone 하기 

git clone https://github.com/Stanford-TML/EDGE.git

 

GitHub - Stanford-TML/EDGE: Official PyTorch Implementation of EDGE (CVPR 2023)

Official PyTorch Implementation of EDGE (CVPR 2023) - Stanford-TML/EDGE

github.com

 

7. wget 설치하기

wget을 이용해서 checkpoint 받으려고 그냥 wget을 설치했다.

 

https://eternallybored.org/misc/wget/

 

GNU Wget 1.21.4 for Windows

 

eternallybored.org

여기서 다운받고, 패스 설정만 해주면 된다.

 

8. 돌려보기-a. 음원 다운받기

demo.ipynb

 

돌리다보면

wandb가 없다고 해서 추가해준다.

einops도 추가 

p_tqdm

 

fbx 임포트 관련 에러도 나는데..  이건

https://forums.autodesk.com/t5/fbx-forum/fbx-python-sdk-for-python-3-9/td-p/11459327

 

FBX Python SDK for Python 3.9

Hello! I'm using Maya 2023 and Unreal Engine 5 which both are using Python 3.9 But I can't find the SDK here :   https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-3   If you install it for Windows,  it is compiled until Pyth

forums.autodesk.com

파이썬 3.9 버전에 맞는 fbx.pyd, fbxCommon.py, fbxsip.pyd를 참조 가능하게 해주면 된다.

 

아 그리고 쥬피터로 돌리고 나면 결과물 폰트가 계속 깨져서... 이리저리 시간을 까먹었는데..

 

youtube-dl도 pip로 설치해주면 되더라.....가 아니었다... youtube-dl은 막혔고, 대신에 yt-dlp 라는걸 pip로 설치해주고, 

 

명령어도

!yt-dlp --extract-audio --audio-format wav --audio-quality 0 --output "{output_folder}/%(id)s.%(ext)s" "ytsearch:{url}"

요렇게 바꾸어줬다. 

 

그러면 

요렇게 유튜브 영상에서 음원을 다운받는다.

 

 

8. 돌려보기-b. 댄스 생성하기

이런 에러가 나서 확인해보니 checkpoint.pt 받아둔 파일의 용량이 3kb 밖에 안된다. 다시 다운로드를 시도해서 1.1기가 짜리를 받아주었다.

 

 

 

다 하고나니 renders 폴더가 생겨서 들어가서 파일을 열어보니

 

이렇게 재생되는 것을 확인해보았다.

 

FBX로는 어떻게 바꾸지?

 

그 뒤로 여러가지를 바꿨는데, 

 

우선 SMPL-to_FBX/convert.py 에서는 

wine을 빼고 위와 같은 명령어만 남겨놨음. 어차피 wine은 리눅스에서 윈도우 프로그램을 실행시키기 위한 거였어서 애초에 윈도우에서 작업한 나에게는 필요없는 부분이었음

 

또 위 에러가 계속 나서 확인해보니, writeFbx 함수가 문제였어서 (fbxReadWriter.py 내) 다음과 같이 수정함

 

def writeFbx(self, write_base: str, filename: str):

        folder_path = os.path.dirname(filename)
        write_base = os.path.join(write_base,folder_path)
        if os.path.isdir(write_base) == False:
            os.makedirs(write_base, exist_ok=True)
       
        base_name = os.path.basename(filename)
        write_path = os.path.join(write_base, base_name.replace(".pkl", ""))

        new_string = write_path.replace('\\', '/')
       

        lResult = SaveScene(self.lSdkManager, self.lScene, new_string)

        if lResult == False:
            raise Exception("Failed to write to {}".format(new_string))

 

 

그럼 결과가 아래처럼 나오긴 하는데,

 

이걸 재생해보면

 

이렇게 잘 나오는 것을 확인할 수 있다.

 

이렇게 EDGE 돌려보기 완료!