当前位置: 首页 > news >正文

Mac上安装tensorflow介绍留存

此预版本为 macOS 11.0+ 提供了硬件加速的 TensorFlow 和 TensorFlow 插件。M1 Mac 和基于 Intel 的 Mac 通过 Apple 的 ML 计算框架支持本机硬件加速。

  • TensorFlow r2.4rc0
  • TensorFlow Addons 0.11.2
    TensorFlow 插件 0.11.2

REQUIREMENTS 要求

  • macOS 11.0+
  • Python 3.8 (required to be downloaded from Xcode Command Line Tools for M1 Macs).
    Python 3.8(需要从适用于 M1 Mac 的 Xcode 命令行工具下载)。

INSTALLATION 安装

An archive containing Python packages and an installation script can be downloaded from the releases.
可以从发行版下载包含 Python 包和安装脚本的存档。

  • To quickly try this out, copy and paste the following into Terminal:
    若要快速尝试此操作,请将以下内容拷贝并粘贴到“终端”中:
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"This will verify your system, ask you for confirmation, then create a virtual environment with TensorFlow for macOS installed.
这将验证您的系统,要求您确认,然后创建一个安装了 TensorFlow for macOS 的虚拟环境。Alternatively, download the archive file from the releases. The archive contains an installation script, accelerated versions of TensorFlow, TensorFlow Addons, and needed dependencies.
或者,从发行版下载存档文件。该存档包含安装脚本、TensorFlow 加速版本、TensorFlow 插件和所需的依赖项。
% curl -fLO https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha2/tensorflow_macos-${VERSION}.tar.gz % tar xvzf tensorflow_macos-${VERSION}.tar % cd tensorflow_macos % ./install_venv.sh --prompt

Installation on Conda 在 Conda 上安装

This pre-release version supports installation and testing using the Python from Xcode Command Line Tools. See #153 for more information on installation in a Conda environment.
此预发布版本支持使用 Xcode 命令行工具中的 Python 进行安装和测试。有关在 Conda 环境中安装的更多信息,请参见 #153。

Notes 笔记

For M1 Macs, the following packages are currently unavailable:
对于 M1 Mac,以下软件包目前不可用:

  • SciPy and dependent packages
    SciPy 和依赖包
  • Server/Client TensorBoard packages
    服务器/客户端 TensorBoard 软件包

When installing pip packages in a virtual environment, you may need to specify --target as follows:
在虚拟环境中安装 pip 包时,可能需要指定 --target 如下:

% pip install --upgrade -t "${VIRTUAL_ENV}/lib/python3.8/site-packages/" PACKAGE_NAME

ISSUES AND FEEDBACK 问题和反馈

Please submit feature requests or report issues via GitHub Issues.
请通过 GitHub 问题提交功能请求或报告问题。

ADDITIONAL INFORMATION 附加信息

Device Selection (Optional)
设备选择(可选)

It is not necessary to make any changes to your existing TensorFlow scripts to use ML Compute as a backend for TensorFlow and TensorFlow Addons.
无需对现有 TensorFlow 脚本进行任何更改,即可将 ML Compute 用作 TensorFlow 和 TensorFlow 插件的后端。

There is an optional mlcompute.set_mlc_device(device_name='any') API for ML Compute device selection. The default value for device_name is 'any', which means ML Compute will select the best available device on your system, including multiple GPUs on multi-GPU configurations. Other available options are 'cpu' and 'gpu'. Please note that in eager mode, ML Compute will use the CPU. For example, to choose the CPU device, you may do the following:
有一个可选 mlcompute.set_mlc_device(device_name='any') 的 API 用于 ML 计算设备选择。的 device_name默认值为 , 'any' 这意味着 ML 计算将选择系统上的最佳可用设备,包括多 GPU 配置上的多个 GPU。其他可用选项包括 'cpu' 和 'gpu' 。请注意,在预先模式下,ML 计算将使用 CPU。例如,要选择 CPU 设备,您可以执行以下操作:

# Import mlcompute module to use the optional set_mlc_device API for device selection with ML Compute. from tensorflow.python.compiler.mlcompute import mlcompute # Select CPU device. mlcompute.set_mlc_device(device_name='cpu') # Available options are 'cpu', 'gpu', and 'any'.

Unsupported TensorFlow Features
不支持的 TensorFlow 功能

The following TensorFlow features are currently not supported in this fork:
此分支目前不支持以下 TensorFlow 功能:

  • tf.vectorized_map
  • Higher-order gradients 高阶梯度
  • Jacobian-vector products (aka. forwardprop)
    雅可比向量积(又名 forwardprop)

Logs and Debugging 日志和调试

Graph mode 图形模式

Logging provides more information about what happens when a TensorFlow model is optimized by ML Compute. Turn logging on by setting the environment variable TF_MLC_LOGGING=1 when executing the model script. The following is the list of information that is logged in graph mode:
日志记录提供了有关 ML 计算优化 TensorFlow 模型时发生的情况的更多信息。通过在执行模型脚本时设置环境变量 TF_MLC_LOGGING=1 来打开日志记录。以下是在图形模式下记录的信息列表:

  • Device used by ML Compute.
    ML 计算使用的设备。
  • Original TensorFlow graph without ML Compute.
    没有 ML 计算的原始 TensorFlow 图。
  • TensorFlow graph after TensorFlow operations have been replaced with ML Compute.
    TensorFlow 操作后的 TensorFlow 图已替换为 ML Compute。
    • Look for MLCSubgraphOp nodes in this graph. Each of these nodes replaces a TensorFlow subgraph from the original graph, encapsulating all the operations in the subgraph. This, for example, can be used to determine which operations are being optimized by ML Compute.
      在此图中查找 MLCSubgraphOp 节点。这些节点中的每一个都替换了原始图中的 TensorFlow 子图,将所有操作封装在子图中。例如,这可用于确定 ML 计算正在优化哪些操作。

  • Number of subgraphs using ML Compute and how many operations are included in each of these subgraphs.
    使用 ML 计算的子图数,以及每个子图中包含的操作数。
    • Having larger subgraphs that encapsulate big portions of the original graph usually results in better performance from ML Compute. Note that for training, there will usually be at least two MLCSubgraphOp nodes (representing forward and backward/gradient subgraphs).
      使用较大的子图来封装原始图形的大部分,通常可以提高 ML 计算的性能。请注意,对于训练,通常至少有两个 MLCSubgraphOp 节点(表示前向和后向/梯度子图)。

  • TensorFlow subgraphs that correspond to each of the ML Compute graphs.
    与每个 ML 计算图相对应的 TensorFlow 子图。

Eager mode 急切模式

Unlike graph mode, logging in eager mode is controlled by TF_CPP_MIN_VLOG_LEVEL. The following is the list of information that is logged in eager mode:
与图形模式不同,预先模式中的日志记录由 TF_CPP_MIN_VLOG_LEVEL 控制。以下是在预先模式下记录的信息列表:

  • The buffer pointer and shape of input/output tensor.
    输入/输出张量的缓冲区指针和形状。
  • The key for associating the tensor’s buffer to built the MLCTraining or MLCInference graph. This key is used to retrieve the graph and run a backward pass or an optimizer update.
    用于关联张量缓冲区以构建 MLCTraining or MLCInference 图的键。此键用于检索图形并运行向后传递或优化器更新。
  • The weight tensor format.
    权重张量格式。
  • Caching statistics, such as insertions and deletions.
    缓存统计信息,例如插入和删除。

Tips for debugging 调试提示

  • Larger models being trained on the GPU may use more memory than is available, resulting in paging. If this happens, try decreasing the batch size or the number of layers.
    在 GPU 上训练的较大模型可能会使用比可用内存更多的内存,从而导致分页。如果发生这种情况,请尝试减小批大小或层数。
  • TensorFlow is multi-threaded, which means that different TensorFlow operations, such as MLCSubgraphOp, can execute concurrently. As a result, there may be overlapping logging information. To avoid this during the debugging process, set TensorFlow to execute operators sequentially by setting the number of threads to 1 (see tf.config.threading.set_inter_op_parallelism_threads).
    TensorFlow 是多线程的,这意味着不同的 TensorFlow 操作(例如 MLCSubgraphOp )可以并发执行。因此,可能存在重叠的日志记录信息。为了避免在调试过程中出现这种情况,请通过将线程数设置为 1 来将 TensorFlow 设置为按顺序执行运算符(请参阅 tf.config.threading.set_inter_op_parallelism_threads)。
  • In eager mode, you may disable the conversion of any operation to ML Compute by using TF_DISABLE_MLC_EAGER=“;Op1;Op2;...”. The gradient op may also need to be disabled by modifying the file $PYTHONHOME/site-packages/tensorflow/python/ops/_grad.py (this avoids TensorFlow recompilation).
    在预先模式下,您可以使用 TF_DISABLE_MLC_EAGER=“;Op1;Op2;...” 禁用任何操作到 ML 计算的转换。可能还需要通过修改文件 $PYTHONHOME/site-packages/tensorflow/python/ops/_grad.py 来禁用梯度运算(这样可以避免 TensorFlow 重新编译)。
  • To initialize allocated memory with a specific value, use TF_MLC_ALLOCATOR_INIT_VALUE=<init-value>.
    要使用特定值初始化分配的内存,请使用 TF_MLC_ALLOCATOR_INIT_VALUE=<init-value> 。
  • To disable ML Compute acceleration (e.g. for debugging or results verification), set the environment variable TF_DISABLE_MLC=1.
    要禁用 ML 计算加速(例如用于调试或结果验证),请设置 环境变量 TF_DISABLE_MLC=1 。

相关文章:

Mac上安装tensorflow介绍留存

此预版本为 macOS 11.0 提供了硬件加速的 TensorFlow 和 TensorFlow 插件。M1 Mac 和基于 Intel 的 Mac 通过 Apple 的 ML 计算框架支持本机硬件加速。 TensorFlow r2.4rc0TensorFlow Addons 0.11.2 TensorFlow 插件 0.11.2 REQUIREMENTS 要求 macOS 11.0Python 3.8 (requir…...

【赠书第16期】码上行动:用ChatGPT学会Python编程

文章目录 前言 1 ChatGPT简介 2 Python编程简介 3 使用ChatGPT学习Python编程 4 如何使用ChatGPT学习Python编程 5 推荐图书 6 粉丝福利 前言 随着人工智能技术的不断发展&#xff0c;聊天机器人已经成为我们日常生活和工作中不可或缺的一部分。其中&#xff0c;ChatGP…...

LeetCode 每日一题 2024/1/1-2024/1/7

记录了初步解题思路 以及本地实现代码&#xff1b;并不一定为最优 也希望大家能一起探讨 一起进步 目录 1/1 1599. 经营摩天轮的最大利润1/2 466. 统计重复个数1/3 2487. 从链表中移除节点1/4 2397. 被列覆盖的最多行数1/5 1944. 队列中可以看到的人数1/6 2807. 在链表中插入最…...

7+单细胞+空转+实验验证,如何根据内容开展相关经验给你启发

导语 今天给同学们分享一篇生信文章“CD8 tissue-resident memory T cells induce oral lichen planus erosion via cytokine network”&#xff0c;这篇文章发表在Elife期刊上&#xff0c;影响因子为7.7。 结果解读&#xff1a; 单细胞RNA测序揭示了具有不同临床亚型的OLP的细…...

Verifiable Credentials可验证证书 2023 终极指南

1. 引言 Dock公司为去中心化数字身份领域的先驱者&#xff0c;其自2017年以来&#xff0c;已知专注于构建前沿的可验证证书&#xff08;Verifiable Credentials&#xff09;技术。本文将阐述何为电子证书、电子证书工作原理、以及其对组合和个人的重要性。 伪造实物证书和数字…...

R语言【sp】——SpatialPoints():创建类SpatialPoints或SpatialPointsDataFrame的对象

Package sp version 1.5-0 Description 从坐标或数据帧的坐标创建类 SpatialPoints-class 或 SpatialPointsDataFrame-class 的对象。 Usage SpatialPoints(coords, proj4stringCRS(as.character(NA)), bbox NULL)SpatialPointsDataFrame(coords, data, coords.nrs numeric…...

【Verilog】期末复习——简要说明仿真时阻塞赋值和非阻塞赋值的区别。always语句和initial语句的关键区别是什么?能否相互嵌套?

系列文章 数值&#xff08;整数&#xff0c;实数&#xff0c;字符串&#xff09;与数据类型&#xff08;wire、reg、mem、parameter&#xff09; 运算符 数据流建模 行为级建模 结构化建模 组合电路的设计和时序电路的设计 有限状态机的定义和分类 期末复习——数字逻辑电路分…...

分享一个idea插件MyBatisX的Bug

分享一个idea插件MyBatisX的Bug The plugin com.baomidou.plugin.idea. mybatisx failed to save settings and has been disabled. Please restart IntelliJ IDEAjava.lang.Throwableat com.intellij.openapi.project.DumbServiceImpl.queueTask(DumbServiceImpl.java:293)at…...

Linux网络

一、Linux网络 查看基础的网络配置 网关、路由&#xff1a;route —n 网关、路由route —nIP地址ifconfig ip aDNS 服务器cat /etc/resolv.conf主机名hostname网络连接状态ss、netstat、syn—sent域名解析nalookup、host 1.1 ifconfig 网络接口配置 临时性修改网卡 …...

Copilot 插件的使用介绍:如何快速上手

GitHub Copilot 本文主要介绍如何通过脚本工具激活 GitHub Copilot 插件&#xff0c;提供安装及激活图文教程&#xff0c;大家按下面操作即可激活GitHub Copilot插件&#xff0c;免费使用Ai编码工具 一、GitHub Copilot 介绍 GitHub Copilot 是由 GitHub 和 OpenAI 共同开发的…...

kubesphere和k8s的使用分享

文章目录 什么是kubernetesKubernetes的部分核心概念互式可视化管理平台与kubernetes的关系市面是常见的kubernetes管理平台 什么是kubesphereKubesphere默认安装的组件Kubesphere涉及的服务组件kubesphere的安装Kubesphere相关的内容 什么是kubernetes 就在这场因“容器”而起…...

macos m1如何安装指定版本的redis

安装指定版本的Redis在macOS M1上可以通过Homebrew进行操作。Homebrew是一个在macOS上管理软件包的常用工具。 要安装特定版本的Redis&#xff0c;请首先确保已经安装了Homebrew。然后&#xff0c;可以通过以下步骤安装指定版本的Redis&#xff1a; 步骤&#xff1a; 查找可用…...

python 多线程 守护线程

daemon线程&#xff1a;守护线程&#xff0c;优先级别最低&#xff0c;一般为其它线程提供服务。通常&#xff0c;daemon线程体是一个无限循环。如果所有的非daemon线程(主线程以及子线程&#xff09;都结束了&#xff0c;daemon线程自动就会终止。t.daemon 属性&#xff0c;设…...

以unity技术开发视角对android权限的讲解

目录 前言 Android权限分类 普通权限 普通权限定义 普通权限有哪些 危险权限 危险权限的定义 危险权限有哪些 动态申请权限实例 申请单个权限实例 第一步&#xff1a;在清单文件中声明权限 第二步&#xff1a;在代码中进行动态申请权限 申请多个权限实例 第一步&am…...

910b上跑Chatglm3-6b进行流式输出【pytorch框架】

文章目录 准备阶段避坑阶段添加代码结果展示 准备阶段 配套软件包Ascend-cann-toolkit和Ascend-cann-nnae适配昇腾的Pytorch适配昇腾的Torchvision Adapter下载ChatGLM3代码下载chatglm3-6b模型&#xff0c;或在modelscope里下载 避坑阶段 每个人的服务器都不一样&#xff0…...

2024年江苏省职业院校技能大赛高职学生组软件测试—任务五接口测试题目

2024年江苏省职业院校技能大赛高职学生组软件测试任务五 接口测试 任务要求 题目1&#xff1a;登录接口脚本编写和执行测试。 1、登录接口描述如下&#xff1a; 接口功能&#xff1a;提供用户登录功能处理&#xff0c;根据传入的用户名和密码判断登录状态。 接口地址&…...

螺旋数字矩阵 - 华为OD统一考试

OD统一考试&#xff08;C卷&#xff09; 分值&#xff1a; 100分 题解&#xff1a; Java / Python / C 题目描述 疫情期间&#xff0c;小明隔离在家&#xff0c;百无聊赖&#xff0c;在纸上写数字玩。他发明了一种写法: 给出数字个数n和行数m (0 < n < 999&#xff0c;…...

更改ERPNEXT源

更改ERPNEXT源 一&#xff0c; 更改源 针对已经安装了erpnext的&#xff0c;需要更改源的情况&#xff1a; 1, 更改为官方默认源, 进入frapp-bench的目录&#xff0c; 然后执行: bench remote-reset-url frappe //重设frappe的源为官方github地址。 bench remote-reset-url…...

配置基本QinQ示例

QinQ简介 定义 QinQ&#xff08;802.1Q-in-802.1Q&#xff09;技术是一项扩展VLAN空间的技术&#xff0c;通过在802.1Q标签报文的基础上再增加一层802.1Q的Tag来达到扩展VLAN空间的功能&#xff0c;可以使私网VLAN透传公网。由于在骨干网中传递的报文有两层802.1Q Tag&#x…...

界面控件DevExpress Blazor Grid v23.2 - 支持全新的单元格编辑模式

DevExpress Blazor UI组件使用了C#为Blazor Server和Blazor WebAssembly创建高影响力的用户体验&#xff0c;这个UI自建库提供了一套全面的原生Blazor UI组件&#xff08;包括Pivot Grid、调度程序、图表、数据编辑器和报表等&#xff09;。 在这篇文章中&#xff0c;我们将介…...

深入剖析pcap中的网络异常:TTL过期攻击、ARP中毒、TCP重传与重叠碎片等

网络流量数据包捕获是网络安全领域的重要部分&#xff0c;而pcap文件则是这一过程的常见载体。为了深入解析pcap文件中潜在的可疑网络流量&#xff0c;我们需要运用强大的网络安全威胁评估与审计工具。这些工具能够帮助我们捕捉、记录、检测和诊断网络中的数据传输问题&#xf…...

网站被挂黑链怎么办

网站被挂黑链这种事情总是防不胜防&#xff0c;且不说网站本身的安全防护做的是否到位&#xff0c;但只要被盯上了就难逃厄运。即使是企业机构的网站也难逃被黑的经历&#xff0c;更何况用户苦心经营的网站&#xff0c;因此首先需要正确看待挂黑链这个现象&#xff0c;网站被挂…...

WPF 导航界面悬浮两行之间的卡片 漂亮的卡片导航界面 WPF漂亮渐变颜色 WPF漂亮导航头界面 UniformGrid漂亮展现

在现代应用程序设计中&#xff0c;一个漂亮的WPF导航界面不仅为用户提供视觉上的享受&#xff0c;更对提升用户体验、增强功能可发现性和应用整体效率起到至关重要的作用。以下是对WPF漂亮导航界面重要性的详尽介绍&#xff1a; 首先&#xff0c;引人入胜的首页界面是用户与软…...

[技术杂谈]使用VLC将视频转成一个可循环rtsp流

通过vlc播放器&#xff0c;将一个视频转成rtsp流&#xff0c;搭建一个rtsp服务器。rtsp客户端可访问这个视频的rtsp流。 1. 打开vlc播放器&#xff0c;使用的版本如下 2. 菜单&#xff1a;媒体 ---> 流 3. 添加视频文件&#xff0c;点击添加一个mp4 文件 4. 选择串流&…...

手机上连网络转接app,电脑连接手机,共用网络转接app的办法

方法一&#xff0c;&#xff08;不推荐&#xff09; 因为太简单了所以写一下 电脑安装MuMu模拟器&#xff0c;之后安装网络转接app&#xff0c;这个模拟器设置了从电脑上安装app和&#xff0c;安卓与电脑同步文件夹功能&#xff0c;实现文件共享。所以直接用就可以了。 方法二…...

k8s中的容器探针

pod的容器健康检查---探针 probe&#xff1a;k8s对容器执行的定期检查&#xff0c;诊断。 探针的三种规则 所有的探针都是针对容器不是针对pod 1、 存活探针---livenessProbe&#xff1a;探测容器是否正常运行。如果发现探测失败&#xff0c;会杀掉容器。容器会根据重启策略…...

4.6 BOUNDARY CHECKS

我们现在扩展了tile矩阵乘法内核&#xff0c;以处理具有任意宽度的矩阵。扩展必须允许内核正确处理宽度不是tile宽度倍数的矩阵。通过更改图4.14中的示例至33 M、N和P矩阵&#xff0c;图4.18创建了矩阵的宽度为3&#xff0c;不是tile宽度&#xff08;2&#xff09;的倍数。图4.…...

Java集合-LinkedList

Java集合-LinkedList 特性 public class LinkedList<E> extends AbstractSequentialList<E>implements List<E>, Deque<E>, Cloneable, java.io.Serializable1、继承于 AbstractSequentialList &#xff0c;本质上面与继承 AbstractList 没有什么区别…...

2023年阿里云云栖大会:前沿技术发布与未来展望

在2023年的阿里云云栖大会上&#xff0c;我见证了云计算和人工智能领域的又一历史性时刻。这次大会不仅是对未来科技趋势的一次深入探索&#xff0c;更是阿里云技术实力和创新能力的集中展示。 首先&#xff0c;千亿级参数规模的大模型通义千问2.0的发布&#xff0c;无疑将人工…...

houdini microscope

【英文原版-无字幕】Wavelets: a mathematical microscope 小波变换最好的入门教程了吧&#xff01;_哔哩哔哩_bilibili 只涉及模拟&#xff0c;不模拟具体对错...

做网站自己买服务器/2022年百度seo

一场突如其来的疫情&#xff0c;打破了所有企业原本的工作习惯&#xff0c;暂停了所有企业的原来的工作计划。其中一部分科技含量较为先进的企业&#xff0c;如互联网企业和大型连锁企业&#xff0c;虽然以往已经购买和配备了应用移动办公软件(如CRM和OA)&#xff0c;但在当下突…...

四核网站建设/牛奶推广软文文章

1. vp8 的下载 页面地址 https://github.com/webmproject/libvpx git 下载 git clone https://github.com/webmproject/libvpx.git2. 在 android 上面搭建的 vp8 环境 页面地址 https://github.com/cmeng-git/vpx-android git 下载 git clone https://github.com/cmeng-gi…...

保定专业网站制作/企业培训十大热门课程

我们知道,大多数情况下,方法的调用都是发生在相同堆上的两个对象之间,所有组件都在同一台计算机的同一个Java虚拟机的同一个堆空间上执行是最简单的&#xff0c;如果用户端只是个能够执行Java的装置怎么办&#xff1f;如果为了安全性的理由只能让服务器上的程序存取数据库怎么办…...

网站建设公司转型/seo快速排名软件平台

原标题&#xff1a;英语口语&#xff1a;加减乘除的英语怎么说&#xff1f;一、加法运算的表示常用and, plus, add 等表示。如&#xff1a;Seven and [plus] eight is [are, make(s)] fifteen. 7加8等于15。If you add ten to eight, you get eighteen. 10加8等于18。二、减法运…...

网站平台方案设计/哪些平台可以发布软文

首先你需要去买一个加密狗设备&#xff0c;加密狗是外形酷似U盘的一种硬件设备! 这里我使用的坚石诚信公司的ET99产品 公司项目需要实现一个功能&#xff0c;就是客户使用加密狗登录, 客户不想输入任何密码之类的东西&#xff0c;只需要插上类似&#xff35;盘的加密狗就验证身…...

上海酒店vi设计公司/深圳seo优化外包

GBDT有两种工业化实现 &#xff1a;XGBoost 和 LightGBM。LightGBM 是在 XGBoost 的基础之上的优化版本。 这里是LightGBM优势讲解第一篇&#xff0c;主要包含XGB的缺陷&#xff0c;LightGBM的优势&#xff0c;以及LightGBM中基于直方图的决策树最优分割点选取 Leaf-wise叶子节…...