tensorflow

上手PyTorch!

非 Y 不嫁゛ 提交于 2021-01-17 03:43:43
在机器学习领域,面对各类复杂多变的业务问题,构建灵活易调整的模型是高阶机器学习工程师必备的工作能力。然而,许多工程师还是有一个想法上的误区,以为只要掌握了一种深度学习的框架就能走遍天下了。 事实上,在机器学习领域里没有任何一种框架是能够制霸整个行业的,每位机器学习工程师都必须同时掌握多种框架才能适应业务发展的需要。 那么有没有一种框架是相对来说更方便好用的呢?这个问题的答案是肯定的,在这里我就要为你推荐 PyTorch了。 不瞒你说, PyTorch 以它良好的扩展性和超高的实现速度,近年来已赢得了不少工程师的喜爱和赞赏。 首先,PyTorch 支持 GPU,这就能够显著提升代码的运行效率。同时, 相比 TensorFlow 和 Caffe,PyTorch 拥有反向自动求导技术, 让你在调整自定义模型的时候不必从头开始,帮助你节省不少的开发时间。 此外, PyTorch 的代码还比 TensorFlow 的代码更加简洁直观、友好易懂, 堪称是非常优质的学习案例,这也能帮助许多工程师更深度地理解机器学习。 说到这里,不得不推荐极客时间 PyTorch 的小课了, 众微科技 AI Lab 负责人王然 手把手教你上手 PyTorch。现在还有少量免费学习的名额哦! 王然手把手教你上手 PyTorch 众微科技 AI Lab 负责人、阿姆斯特丹大学数学和计量经济学双硕士--王然, 将

AI火爆干货最全整理!五套深度学习和算法学习教程和三套Python学习视频!!!限时无套路免费领取!

岁酱吖の 提交于 2021-01-16 04:55:56
点击蓝色“ AI专栏 ”关注我 哟 选择“ 星标 ”,重磅干货,第一时间送达 这是站长第 31 期免费送丰富宝贵的干货资源与教程 本期绝对是 满满的干货 ! 获取更多资源请关注 【AI专栏】 先上车pa 01 PART 五套深度学习算法教程! 作为AI 初学者来说,最大的问题就是: 资料太多!!!看不完!!! 不知道如何取舍!!!人的精力有限!!! 因此,本次站长就为各位站友把 高效有用 的入门和进阶学习材料整理好了, 并限时无套路免费送给各位站友!!! AI学习不仅仅在于模型掌握了多少,更多的在于你的算法分析和设计能力、工程实践能力、算法模型的优化能力。 5本享誉全球的AI好书和项目 免费 送给大家 !!! 机器学习基础 《机器学习基础》来了, 一书吃透机器学习! 先总体来看,这本书分为17个章节: 从每一个章节的设置可以看出这份教材设置的非常细致,将机器学习中的基础概念拆分开来讲,想深入了解吃透深度学习的基础,按这个目录来学也是个不错的选择。 【AI专栏】 只做 干货!!! 在这里没有任何套路!你只需要 长按下方二维码 回复【 2020 】 加站长微信即可立即获取 五套深度学习和算法学习教程和三套Python学习视频!!! 现在关注他,还有机会添加他的个人微信号,进行一对一的交流,坑位有限(微信号有 5000 人的限制),大家抓紧吧! PyTorch官方教程中文版

如何简单理解Google 1.6万亿参数的Switch Transformer论文?

£可爱£侵袭症+ 提交于 2021-01-15 19:21:30
Switch Transformer 可以理解成一种如何在训练基于MOE (Mixture of Experts) 的巨模型时“ 偷工减料 ”的技巧,但这种“偷工减料”却蕴含了一些新的洞察(insights)。 在一般情况下,基于MoE,一个样例进来,会被好几个子网络(expert)处理,这几个子网络的处理结果可以加权求和,每个子网络的权重是通过一个叫router的模块计算出来的( 如下图所示 )。MoE可以理解成一种模型的集成 (ensemble),根据top k 激活一部分子网络。按照我们对模型集成的经验,一般来说,集成的结果应该要比每一个子网络单独的效果好 (这一点很重要,后文还会提到)。当然,这也让MoE的不足之处展现出来,每个子网络都需要进行计算,总计算量是所有子网络计算量之和。不过,MoE 使用所有子网络不一定就比只使用一个网络好,sparsity 可以让每个子网络更“聚焦”,分工更明确,带来的优势还需进一步观察。 Switch Transformer 的发现是什么? 如下图所示 ,每一个样例进来不需要被所有的子网络处理,只被router模块权重最大的子网络处理,这个子网络的结果再乘以这个权重就可以了,计算量一下子变成了MoE的四分之一。 计算量是少了,效果会有损失吗?按常规的理解来说,效果应该是有损失的,不过这篇论文并没有提供一组实验结果正面回答这个问题。Table

tensorflow c++接口的编译安装与一些问题记录

橙三吉。 提交于 2021-01-13 21:01:17
参考 这篇文章 安装,依次安装bazel,protocbuf,eigen3,然后下载tensorflow源码,编译c++ api,将编译结果拷贝到搜索路径 最后测试案例时遇到一些问题 (1)fatal error: absl/strings/string_view.h 解决方案 ,git clone https://github.com/abseil/abseil-cpp,然后把该库加到搜索目录里面 (2)对‘tensorflow::SessionOptions::SessionOptions()’未定义的引用 找不到正确的libtensorflow_cc.so,添加动态链接库路径 (3)tensorflow::status::tostring[abi:cxx11]() const 解决方案 ,编译选项设置-D_GLIBCXX_USE_CXX11_ABI=0 最终测试代码 1 #include <tensorflow/core/platform/env.h> 2 #include <tensorflow/core/ public /session.h> 3 4 #include <iostream> 5 6 using namespace std; 7 using namespace tensorflow; 8 9 int main() 10 { 11 Session*

Object Detection on Android with Tensorflow Lite

喜你入骨 提交于 2021-01-13 11:21:01
问题 Trying to implement a custom object detection model with Tensorflow Lite, using Android Studio. I am following the guidance provided here: Running on mobile with TensorFlow Lite, however with no success. The example model runs properly showing all the detected labels. Nonetheless, when I try with my custom model I am not getting any labels at all. I have also tried with other models(from the internet but the outcome is the same). It is like that the labels are not being passed with the write

Object Detection on Android with Tensorflow Lite

。_饼干妹妹 提交于 2021-01-13 11:20:47
问题 Trying to implement a custom object detection model with Tensorflow Lite, using Android Studio. I am following the guidance provided here: Running on mobile with TensorFlow Lite, however with no success. The example model runs properly showing all the detected labels. Nonetheless, when I try with my custom model I am not getting any labels at all. I have also tried with other models(from the internet but the outcome is the same). It is like that the labels are not being passed with the write

Custom Attention Layer using in Keras

非 Y 不嫁゛ 提交于 2021-01-13 09:49:51
问题 I want to create a custom attention layer that for input at any time this layer returns the weighted mean of inputs at all time inputs. For Example, I want that input tensor with shape [32,100,2048] goes to layer and I get the tensor with the shape [32,100,2048] . I wrote the Layer as follow: import tensorflow as tf from keras.layers import Layer, Dense #or from tensorflow.keras.layers import Layer, Dense class Attention(Layer): def __init__(self, units_att): self.units_att = units_att self.W

Understanding WeightedKappaLoss using Keras

大城市里の小女人 提交于 2021-01-13 06:00:50
问题 I'm using Keras to try to predict a vector of scores (0-1) using a sequence of events. For example, X is a sequence of 3 vectors comprised of 6 features each, while y is a vector of 3 scores: X [ [1,2,3,4,5,6], <--- dummy data [1,2,3,4,5,6], [1,2,3,4,5,6] ] y [0.34 ,0.12 ,0.46] <--- dummy data I want to adress the problem as ordinal classification, so if the actual values are [0.5,0.5,0.5] the prediction [0.49,0.49,0.49] is better then [0.3,0.3,0.3] . My Original solution, was to use sigmoid

Understanding WeightedKappaLoss using Keras

橙三吉。 提交于 2021-01-13 06:00:26
问题 I'm using Keras to try to predict a vector of scores (0-1) using a sequence of events. For example, X is a sequence of 3 vectors comprised of 6 features each, while y is a vector of 3 scores: X [ [1,2,3,4,5,6], <--- dummy data [1,2,3,4,5,6], [1,2,3,4,5,6] ] y [0.34 ,0.12 ,0.46] <--- dummy data I want to adress the problem as ordinal classification, so if the actual values are [0.5,0.5,0.5] the prediction [0.49,0.49,0.49] is better then [0.3,0.3,0.3] . My Original solution, was to use sigmoid

20种小技巧,玩转Google Colab

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-13 05:54:42
本文转载自机器之心。 选自amitness.com 作者:Amit Chaudhary 机器之心编译 编辑:陈萍 Google Colab 给广大的 AI 开发者提供了免费的 GPU,你可以在上面轻松地跑 Tensorflow、Pytorch 等深度学习框架。但关于 Colab 的使用技巧你又掌握了多少呢?这篇文章将介绍 20 种 Colab 使用技巧,帮你提高使用效率。 1. 便签本 Notebook 当我们在 colab 上尝试一些临时的东西时,我们会创建一堆杂乱、没有标题的 Notebook。 为了解决这个问题,你可以把以下链接加入书签:https://colab.research.google.com/notebooks/empty.ipynb 这将打开一个特殊的 scratch notebook,并且你对该 notebook 所做的任何更改都不会保存到你的主目录中。 2. 单元计时 通常,我们手动计算一段代码的开始时间和结束时间之间的差值来衡量所花费的时间。Colab 提供了内置功能来执行此操作。在执行了一个单元(cell)之后,将鼠标悬停在单元运行图标上,你将获得代码执行时间的估计值。 3. 运行某个单元的一部分 你也可以运行某个单元的一部分,通过选择单元格并点击 Runtime 索引到 Run Selection 按钮或使用键盘快捷键 Ctrl + Shift +