첫 글이다.
나 같은 사람이 있을 것 같아서 정리해보고자 블로그를 개설했다
퇴사 후 컴퓨터가 없던 나는 윈도&우분투 + 그래픽카드 vs M1 시리즈 중 고민을 상당히 많이 했다.
윈도&우분투의 경우 기존 회사에서 쓰던 스펙으로 맞추려면 못해도 500~1000만 원 까지 예산이 드는데, 퇴직금 다 때려 박아도 못 맞추더라....
그래서 M1 쪽으로 눈을 돌렸는데 아는 선배의 맥미니 M1으로 테스트했을 때 google Colab보다 빠른 결과를 내길래 고민 않고 바로 중고로 질렀다.
작성일 (2022.11.08) 기준 M1으로 안되는 서비스나 머신러닝 라이브러리 등을 정리해보았다.
참고로 본인은 음악 & 오디오 관련 엔진 등을 개발하던 사람이므로 참고 바란다.
또 참고로 이런거 처음 해봐서 기존 구글링을 통해 나오는 정보들보다 허접할 수 있다.
1. Torch
- M1컴퓨터에서 예전 글들 같은 경우는 뭐 콘다 설치하고 좀 복잡하게 설치하는 거 같은데 현재(2022.11.08) 기준으론 그냥 pip install torch만 해줘도 잘 설치된다.
- 간단한 Mnist 엔진을 돌렸을 때 MPS로 잘 돌아가며, google Colab보다 빠르다 (내가 맥미니 M1을 산 이유)
https://colab.research.google.com/drive/1uzz1qSlBQPnFztKCE-EmMXFGE7JQWFyE
Google Colaboratory Notebook
Run, share, and edit Python notebooks
colab.research.google.com
Training MNIST on the M1 GPU with PyTorch.
Training MNIST on the M1 GPU with PyTorch. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
- 그런데 FFT관련 함수들을 돌렸을때 에러가 난다
UserWarning: The operator 'aten::_fft_r2c' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications.
이런 오류가 나는데, 현재 torch에선 FFT관련 기능을 MPS로 못 돌리는 것 같다
- 구글링을 이것저것 해보니, mps에서 복소수 연산이 제대로 안돼서 이렇게 막혀있는 것 같다.
- 나는 음악 & 오디오 엔진을 만들기 때문에 FFT는 필수인데, 이게 안된다...
- torch를 사용하는 오디오 라이브러리 중, Audio Separate를 해주는 Demucs라는 라이브러리가 torch 기반이다.
https://github.com/facebookresearch/demucs
GitHub - facebookresearch/demucs: Code for the paper Hybrid Spectrogram and Waveform Source Separation
Code for the paper Hybrid Spectrogram and Waveform Source Separation - GitHub - facebookresearch/demucs: Code for the paper Hybrid Spectrogram and Waveform Source Separation
github.com
- 그렇다고 M1에서 Demucs를 못 돌리는 건 아니다. 백엔드를 CPU로 해주면 돌아가고 MPS로 하면 에러가 발생한다.
- 이건 torch에서 업데이트를 해주지 않으면 내 수준에선 어떻게 해볼 수 없을 것 같다.
2. Tensor flow
- 그냥 밑바닥부터 엔진을 만드는 거라면 Tensor flow를 써도 괜찮다.
- 간단한 mnist 엔진을 돌렸을 때, Google Colab과 맥미니 M1의 속도가 비슷하다
https://colab.research.google.com/drive/1TSMsq8b697KsujqaLzhLNIkHyN-XjoZ1?hl=ko
Google Colaboratory Notebook
Run, share, and edit Python notebooks
colab.research.google.com
- 근데 Tensorflow를 기반으로 하는 라이브러리 등은 에러가 난다.
- spleeter, basic-pitch 안된다.
https://github.com/deezer/spleeter/issues/798
Installation Issues Mac M1 · Issue #798 · deezer/spleeter
Hi, I've been trying to install spleeter on my mac m1 for over a week now and I'm a bit lost on why some have had success, and I can't seem to get it to work. I've followed this dis...
github.com
https://github.com/spotify/basic-pitch/issues/41
Unable to install basic-pitch on MacOS 12 and 13 · Issue #41 · spotify/basic-pitch
It fails when I install basic-pitch on MacOS 12 and 13. I am on an Apple M1 Pro. I've attempted Python 3.8, 3.9, and 3.10, but they all fail. This issue also happened before I upgraded to macOS...
github.com
- 로제타로 텐서 플로우를 깐 다음에 위 라이브러리를 설치하면 된다고는 하는데 아직 나는 성공 못하고 있다..
결론
아직 세팅한 지 하루도 안돼서 다 해본건 아니지만, 더 안될 기능들이 많아 보인다.
M1을 살 때 현재 내가 진행 중인 프로젝트가 오디오 관련 프로젝트이면서, 핵심 라이브러리가 Tensor flow, Torch 기반의 라이브러리라면 고민하길 바란다.