본문 바로가기

프로젝트/Project1

Toy Project 1 (7) - M1 mac 설정하기(삽질)

전 처리에 필요한 pycospacing을 사용하는데 계속 에러가 발생했다. 처음에는 buffer error로 보였는데, 근본적인 문제는 m1 silicon mac OS에서 tensorflow를 사용하려면 기존의 conda로는 불가능하다는 것이었다. 아래의 링크를 통해 miniforge3을 설치하고, channel을 conda-forge로 맞추는 등 필요한 환경 설정을 해야 한다. (mac OS version 12) mac으로 데이터 분석하기 너무 힘들다...

 

TF 2.6 version

https://developer.apple.com/metal/tensorflow-plugin/ 

 

Metal - Apple Developer

Find presentations, documentation, sample code, and resources for building macOS, iOS, and tvOS apps with the Metal framework.

developer.apple.com

 

 

TF 2.5 version

https://developer.apple.com/forums/thread/691304?answerId=689811022#689811022 

 

Install Tensorflow fail on M1 | Apple Developer Forums

https://developer.apple.com/metal/tensorflow-plugin/ Follow the URL to install tensorflow, but get several errors conda install -c apple tensorflow-deps getting the error is famous "PEP 517". conda install -c apple tensorflow-deps=2.5.0 the error is resolv

developer.apple.com

 

pykospacing은 tf25에서 동작하기 때문에 위의 tf25 가상 환경을 추가로 만들었다. 그리고 jupyter notebook에서 추가로 kernel을 등록해서 tensorflow 버전이 충돌하는 것을 막을 수 있다.

 

https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084

 

How to add your Conda environment to your jupyter notebook in just 4 steps

In this article I am going to detail the steps, to add the Conda environment to your Jupyter notebook.

medium.com

 

 

pykospacing을 clone한 뒤에 setup.py의 tensorflow 버전을 맞춘다. python setup.py install 명령으로 설치를 하면 잘 실행된다.

 

https://github.com/haven-jeon/PyKoSpacing

 

 

 

 

 

그런데 계속 kernel dead가 발생했다. 아래의 두 가지 방법으로도 효과가 없었다.

https://ichi.pro/ko/apple-m1-maceseo-jupyter-noteubug-eul-silhaenghaneun-bangbeob-189367456078956

https://www.linkedin.com/pulse/leveraging-power-jupyter-notebooks-chinmay-wyawahare

 

colab에서도 돌려보고 했는데 계속 에러가 발생했다. 결국 KoNLPy의 mecab을 사용하기로 했다.

https://konlpy.org/ko/latest/

https://github.com/hexists/konlpy/wiki/konlpy-X-m1-silicon

 

잘 작동된다. 다음 포스트에서 본격적인 tokenization을 진행할 것이다.