Pytorch
文章平均质量分 90
hanfeixue2001
修身
展开
-
Pytorch笔记-6
Text Classification with the torchtext library本教程,我们将展示如何使用torchtext库,构建文本分类分析用的数据集。用户将能灵活做以下几项:Access to raw data as iteratorBuild data processing pipeline to convert the raw text strings into torch.Tensor that can be used to train the modelShuffle a原创 2021-03-31 14:45:03 · 573 阅读 · 0 评论 -
Pytorch笔记-4
NLP FROM SCRATCH:GENERATING NAMES WITH A CHARACTER-LEVEL RNN这是“NLP From Scratch”系列的第二个教程。第一个教程“NLP From Scratch: Classifying Names with a Character-Level RNN”是把names进行分类到对应的language category,本教程将会反过来,根据language category生成相应的names。如下:> python sample.py原创 2021-02-26 09:43:36 · 296 阅读 · 1 评论 -
Pytorch笔记-5
NLP FROM SCRATCH: TRANSLATION WITH A SEQUENCE TO SEQUENCE NETWORK AND ATTENTION这是“NLP from Scratch”系列的第三个教程,也是最后一个。这个教程将会以自己写的多个类和函数来处理数据,并构建我们的NLP模型任务。本教程,我们将构建一个神经网络模型完成法语翻译英语的任务。[KEY: > input, = target, < output]> il est en train de peindr原创 2021-02-24 21:16:26 · 409 阅读 · 0 评论 -
Pytorch笔记-3
NLP FROM SCRATCH: CLASSIFY NAMES WITH A CHARACTER-LEVEL RNN我们将建立和训练一个基于字符级的RNN模型,用来分类words。本教程将展示如何从零开始预处理数据,然后构建NLP模型。特别是没有使用torchtext的一些功能情况下,如何用底层模块进行NLP建模前的预处理工作。基于字符级的RNN模型,以a series of characters的形式读取words,最终的预测的输出结果,是这个words属于哪一类。具体来说,我们将18种语言的几千原创 2021-01-27 15:35:44 · 285 阅读 · 0 评论 -
Pytorch笔记-2
1. Sequence-to-Sequence modeling with nn.Transformer and torchtext使用nn.Transformer模块训练sequence-to-sequence模型。pytorch1.2版本之后包含了标准的transformer模块, 这个模块是基于paper《Attention is All You Need》。nn.Transformer模块完全依赖注意力机制,来构建从输入到输出的全局依赖关系。nn.Transformer(d_model=512原创 2020-12-29 21:41:02 · 1312 阅读 · 4 评论 -
Pytorch笔记-1
what is Pytorch深度学习框架,提供最大的灵活性和速度支持GPU计算能力TensorsTensors 类似于Numpy中的ndarrays,但Tensors能够在GPU上加速计算。from __future__ import print_functionimport torch# 声明一个未初始化的矩阵x = torch.empty(5, 3)print(x)# 创建一个5*3的零矩阵,dtype设置为longx = torch.zeros(5, 3, dtype=原创 2020-11-30 17:03:09 · 1086 阅读 · 2 评论