• Mac M1开发环境配置---tensorflow


    1. 安装conda环境, miniconda

    这里采用的Miniconda(精简版Anaconda)下载地址:Miniconda — Conda documentation 

    安装完成后,需要运行~/.bash_profile, 路径设置才能起作用

    2. 建立python虚拟开发环境

    可以python3.8或者3.9

    我们这里用的3.9

    conda create -n py39tf python=3.9 

    3. 安装tensorflow包支持

     

    conda install -c apple tensorflow-deps # Step 1: Environment setup Install the TensorFlow dependencies: 
    pip install tensorflow-macos # Step 2: Install base TensorFlow 
    pip install tensorflow-metal # Step 3: Install tensorflow-metal plugin

    4. 环境测试验证

    1. (py39) myself@192 tensorflow-dev % python
    2. Python 3.9.12 (main, Jun 1 2022, 06:34:44)
    3. [Clang 12.0.0 ] :: Anaconda, Inc. on darwin
    4. Type "help", "copyright", "credits" or "license" for more information.
    5. >>> import tensorflow as tf
    6. tf.te>>> tf.test.is_gpu_available()
    7. WARNING:tensorflow:From :1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
    8. Instructions for updating:
    9. Use `tf.config.list_physical_devices('GPU')` instead.
    10. Metal device set to: Apple M1
    11. systemMemory: 8.00 GB
    12. maxCacheSize: 2.67 GB
    13. 2022-07-27 20:32:19.519444: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
    14. 2022-07-27 20:32:19.520494: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: )
    15. True
    16. >>> tf.config.list_physical_devices('GPU')
    17. [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
    18. >>>

     搞定。 

  • 相关阅读:
    RHEL8.0安装+基础命令练习+discuz(lamp)论坛搭建
    ADB环境搭建和抓取Crash日志实践总结
    做了个 chrome 插件实现 B 站视频截图功能,直接从当前视频帧无损复制
    推荐一款好用的代码可视化工具
    基于JavaWeb+MySQL的学院党费缴费系统
    深入理解Scrapy
    815 - Flooded! (UVA)
    设计模式——桥接模式
    gateway之整合sentinel流控降级
    2023年8月知识复习
  • 原文地址:https://blog.csdn.net/pocean2012/article/details/126022705