[Tensorflow] M1 MacOS 텐서플로 설치

2022. 12. 16. 21:05·AI/Deep Learning

텐서플로는 딥러닝을 위한 프레임워크로 많이들 접해봤을 파이토치(PyTorch)와 케라스(Keras)와 같이 전세계적으로 많이 사용되고 있습니다.

 

텐서플로는 파이썬(Python)과 C++ API를 기본적으로 제공하고 있습니다!

저는 현재 M1 pro Apple Silicon을 사용하고 있으므로 MacOS 기준으로 텐서플로를 설치하였습니다.

 

애플에서 지원하는 내용을 참고하여 작성합니다!

(참고 : https://developer.apple.com/metal/tensorflow-plugin)

(참고 : https://www.tensorflow.org/install/docker)

(추가참고 : https://developer.apple.com/forums/thread/721619 ) 

 

 

Metal Overview - Apple Developer

Metal powers hardware-accelerated graphics on Apple platforms by providing a low-overhead API, rich shading language, tight integration between graphics and compute, and an unparalleled suite of GPU profiling and debugging tools.

developer.apple.com

 

 

⭐️ 설치방법

  1. https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh 으로 접속해 Miniconda를 다운로드 합니다. Downloads파일에 다운 받아주세요!
  2. Commad + Space를 누르시면 검색창이 나오는데 "터미널" 이나 "Terminal" 입력후 아래 코드 입력해주세요.
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate

 

   3. conda를 이용해 가상환경을 생성하고 활성화합니다. (conda env list 명령어를 통해 가상환경 확인)

conda create --name mytensorflow python=3.8
conda env list
conda activate mytensorflow

   

    4. MacOS용 텐서플로와 플러그인을 설치해줍니다. (단 특정 버전에서 오류가 존재하여 해당 버전으로 설치하였습니다)

conda install -c apple tensorflow-deps
python -m pip install tensorflow-macos==2.9
python -m pip install tensorflow-metal==0.5.0

   

    5. python을 실행시켜 잘 작동하는지 확인해봅시다!

python
import tensorflow as tf
print(tf.reduce_sum(tf.random.normal([1000,1000])))

다들 성공적으로 설치가 되셨으면 좋겠습니다!

'AI > Deep Learning' 카테고리의 다른 글

[Tensorflow] 3. 분류 (Classification)  (0) 2023.01.07
[Tensorflow] 2-1 Regression with Boston housing datasets  (0) 2023.01.07
[Tensorflow] 2. 회귀(Regression)  (0) 2023.01.05
[Tensorflow] 1. 논리연산을 위한 신경망 네트워크 생성  (0) 2023.01.04
[Tensorflow] 0. 신경망 네트워크의 구성  (0) 2023.01.04
'AI/Deep Learning' 카테고리의 다른 글
  • [Tensorflow] 2-1 Regression with Boston housing datasets
  • [Tensorflow] 2. 회귀(Regression)
  • [Tensorflow] 1. 논리연산을 위한 신경망 네트워크 생성
  • [Tensorflow] 0. 신경망 네트워크의 구성
임파카
임파카
[ML & Statistics] 모바일 버전에서 수식 오류가 있어 PC 환경에서 접속하는 것을 권장합니다.
  • 임파카
    무기의 스탯(Stat)
    임파카
  • 전체
    오늘
    어제
    • Study (151)
      • Data Science (45)
        • Modeling (18)
        • Manipulation (21)
        • Visualization (5)
      • Statistics (60)
        • Mathmetical Statistics (54)
        • Categorical DA (1)
      • Web Programming (17)
      • Marketing (0)
      • AI (26)
        • Machine Learning (16)
        • Deep Learning (10)
      • 활동 및 프로젝트 (3)
  • 인기 글

  • hELLO· Designed By정상우.v4.10.5
임파카
[Tensorflow] M1 MacOS 텐서플로 설치
상단으로

티스토리툴바