layer

[NLP] Reformer: The Efficient Transformer

时光怂恿深爱的人放手 提交于 2020-07-27 03:40:10
1.现状 (1) 模型层数加深 (2) 模型参数量变大 (3) 难以训练 (4) 难以fine-tune 2. 单层参数量和占用内存分析 层 参数设置 参数量与占用内存 1 layer 0.5Billion 0.5Billion * 4Byte = 2GB embedding layer 64K tokens 1024 emb_size 8 batch_size 参数量 64K × 1K × 8 = 0.5B 内存 2GB 3. Transformer 模型内存占用的问题以及Reformer相应解决方案 Transformer 内存占用的问题 Reformer采用的方案 实现的效果 对模型的影响 memory(N layer) > N * memory(1 layer) → 需要为反向传播保留值 Reversible layers 保留N层activations → 保留1层 negligible feed-forward 层 d_ff >> d_model, 占据大量内存 split activation && process in chunks d_ff → 每个chunk中处理的维度 numerically identical Attention 运算: O(L^2):存储 && 计算开销都很大 Locality-Sensitive Hashing 局部敏感哈希,简称 LSH

用 Python 可以实现侧脸转正脸?我也要试一下!

时光毁灭记忆、已成空白 提交于 2020-07-26 13:08:00
作者 | 李秋键 责编 | Carol 封图 | CSDN 下载自视觉中国 很多人学习python,不知道从何学起。 很多人学习python,掌握了基本语法过后,不知道在哪里寻找案例上手。 很多已经做案例的人,却不知道如何去学习更加高深的知识。 那么针对这三类人,我给大家提供一个好的学习平台,免费领取视频教程,电子书籍,以及课程的源代码! QQ群:1097524789 近几年来GAN图像生成应用越来越广泛,其中主要得益于GAN 在博弈下不断提高建模能力,最终实现以假乱真的图像生成。 GAN 由两个神经网络组成,一个生成器和一个判别器组成,其中生成器试图产生欺骗判别器的真实样本,而判别器试图区分真实样本和生成样本。这种对抗博弈下使得生成器和判别器不断提高性能,在达到纳什平衡后生成器可以实现以假乱真的输出。 其中GAN 在图像生成应用最为突出,当然在计算机视觉中还有许多其他应用,如图像绘画,图像标注,物体检测和语义分割。在自然语言处理中应用 GAN 的研究也是一种增长趋势, 如文本建模,对话生成,问答和机器翻译。 然而,在 NLP 任务中训练 GAN 更加困难并且需要更多技术,这也使其成为具有挑战性但有趣的研究领域。 而今天我们就将利用CC-GAN训练将侧脸生成正脸的模型,其中迭代20次结果如下: 实验前的准备 首先我们使用的python版本是3.6.5所用到的模块如下

Keepalived 原理与实战

喜欢而已 提交于 2020-07-26 12:28:04
Keepalived 原理与实战 随着系统架构的逐渐演化,服务器的数量和结构会越来越复杂,例如 Web 服务器集群的搭建,提高了系统的性能,同时也提高了系统维护的复杂度,我们需要对集群中各台服务器进行监控,来保证为用户提供服务的是正常运行的服务器,整体系统的 可用性 就至关重要。 Keepalived 简介 什么是Keepalived ? Keepalived一个基于 VRRP 协议来实现的 LVS 服务高可用方案,可以利用其来解决单点故障。一个LVS服务会有2台服务器运行Keepalived,一台为主服务器(MASTER),一台为备份服务器(BACKUP),但是对外表现为一个 虚拟IP ,主服务器会发送特定的消息给备份服务器,当备份服务器收不到这个消息的时候,即主服务器宕机的时候, 备份服务器就会接管虚拟IP,继续提供服务,从而保证了高可用性。 Keepalived 的作用 如上述所说, Keepalived 提供了很好的 高可用性保障服务 ,它可以检查服务器的状态,如果有服务器出现问题,Keepalived 会将其从系统中移除,并且同时使用备份服务器代替该服务器的工作,当这台服务器可以正常工作后,Keepalived 再将其放入服务器群中,这个过程是 Keepalived 自动完成的,不需要人工干涉,我们只需要修复出现问题的服务器即可。 Keepalived 原理

Cesium笔记(3):基本控件简介—ImageryProvider地图瓦片地图配

夙愿已清 提交于 2020-07-25 07:28:13
cesiumjs中可定制多种图层,可以使用互联网上很多地图提供商的图层数据,也可以使用自己的地图数据。Cesium支持多种标准化格式的GIS瓦片服务,可以把栅格图层绘制到地球的表面——cesiumjs的地图图层本质上是一些瓦片数据,这些图层的亮度、对比度、色相均可以动态调整。 对于地图瓦片数据,OGC(Open Geospatial Consortium开放地理联盟)有很多标准,如TMS、WMTS、各个商业公司也有自己的内部标准。推荐阅读:《 OGC标准WMTS服务概念与地图商的瓦片编号流派-web地图切片加载 》 cesiumjs支持的图层格式 wms TMS WMTS (with time dynamic imagery) ArcGIS Bing Maps Google Earth Mapbox OpenStreetMap 默认地,Cesium使用Bing Maps作为默认的图层。这个图层被打包进Viewer中用于演示。Cesium需要您自己创建ion account然后生成一个access key用于访问图层数据。 Cesium ion Cesium ion是一个提供瓦片图和3D地理空间数据的平台,Cesium ion支持把数据添加到用户自己的CesiumJS应用中。下面我们将使用Sentinal-2二维贴图和Cesium世界地形,二者都需要ion的支持。

理解Pytorch中LSTM的输入输出参数含义

依然范特西╮ 提交于 2020-07-25 04:23:06
本文不会介绍LSTM的原理,具体可看如下两篇文章 Understanding LSTM Networks DeepLearning.ai学习笔记(五)序列模型 -- week1 循环序列模型 1、举个栗子 在介绍LSTM各种参数含义之前我们还是需要先用一个例子(参考 LSTM神经网络输入输出究竟是怎样的?Scofield的回答 )来理解LSTM。 Recurrent NNs,一般看的最多的图是这个: rnn但是这个图对初学者相当不太友好。个人认为,目前所有的关于描述RecurrentNNs的图都画得不好,不够明确,里面的细节丢失了。(事实上里面一个"A"仅仅表示了一层的变换,具体如下图所示。) 非常清楚,这是很多初学者不能理解RecurrentNNs的根本原因,即在于 Recurrent NNs是在time_step上的拓展 的这一特性。MLP好理解,CNN也好理解,但Recurrent NNs,就是无法搞清楚里面的拓扑结构,跟MLP联系不上。 先看看MLP,很好理解,就是一张网络清楚地显示了张量流向。 general MLP是这样的拓扑: mlp然后CNN也好理解,跟MLP无差若干,只是权重运算由 \(*\) 变为 \(\otimes\) 。CNN是这样的拓扑: 但RecurrentNNs的拓扑发生了一个很大的改动,即一个MLP会在time_step这个维度上进行延伸

[译]Vulkan教程(17)帧缓存

本秂侑毒 提交于 2020-07-24 18:08:01
[译]Vulkan教程(17)帧缓存 Framebuffers 帧缓存 We've talked a lot about framebuffers in the past few chapters and we've set up the render pass to expect a single framebuffer with the same format as the swap chain images, but we haven't actually created any yet. 我们在过去的章节谈论过很多次帧缓存了,我们已经设置了render pass,希望有一个帧缓存with与交换链image相同的格式,但是我们还没有创建帧缓存。 The attachments specified during render pass creation are bound by wrapping them into a VkFramebuffer object. A framebuffer object references all of the VkImageView objects that represent the attachments. In our case that will be only a single one: the color attachment.

How can I get overlapping divs with relative positions?

早过忘川 提交于 2020-06-22 06:56:23
问题 I want a few divs to be positioned in a line next to each other, but also allow them to overlap the previous div. What I'm trying to get is a timeline with divs for events of certain length. The events can overlap each other. My idea was to give each div the same top position, an increasing z-index and an increasing left position (according to the time of the event). Later I would pop individual divs out by mouse-over events to visualise the overlap. What I do is to make it so each div gets

How can I get overlapping divs with relative positions?

最后都变了- 提交于 2020-06-22 06:55:09
问题 I want a few divs to be positioned in a line next to each other, but also allow them to overlap the previous div. What I'm trying to get is a timeline with divs for events of certain length. The events can overlap each other. My idea was to give each div the same top position, an increasing z-index and an increasing left position (according to the time of the event). Later I would pop individual divs out by mouse-over events to visualise the overlap. What I do is to make it so each div gets

understanding output shape of keras Conv2DTranspose

喜夏-厌秋 提交于 2020-05-29 06:38:31
问题 I am having a hard time understanding the output shape of keras.layers.Conv2DTranspose Here is the prototype: keras.layers.Conv2DTranspose( filters, kernel_size, strides=(1, 1), padding='valid', output_padding=None, data_format=None, dilation_rate=(1, 1), activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None ) In the documentation

2D DenseUnet-based脑胶质瘤分割BraTs+论文翻译+代码实现

喜欢而已 提交于 2020-05-09 16:21:16
论文代码: https://github.com/NYUMedML/DARTS 1、摘要 Quantitative, volumetric analysis of Magnetic Resonance Imaging (MRI) is a fundamental way researchers study the brain in a host of neurological conditions including normal maturation and aging. Despite the availability of open-source brain segmentation software, widespread clinical adoption of volumetric analysis has been hindered due to processing times and reliance on manual corrections. Here, we extend the use of deep learning models from proof-of-concept, as previously reported, to present a comprehensive segmentation of cortical and deep gray