lyj157175
码龄10年
关注
提问 私信
  • 博客:120,797
    120,797
    总访问量
  • 42
    原创
  • 1,986,718
    排名
  • 45
    粉丝
  • 0
    铁粉

个人简介:Github: https://github.com/lyj157175

IP属地以运营商信息为准,境内显示到省(区、市),境外显示到国家(地区)
IP 属地:美国
  • 加入CSDN时间: 2015-03-11
博客简介:

lyj223061的博客

查看详细资料
个人成就
  • 获得102次点赞
  • 内容获得26次评论
  • 获得525次收藏
  • 代码片获得5,493次分享
创作历程
  • 20篇
    2021年
  • 20篇
    2020年
  • 2篇
    2019年
成就勋章
TA的专栏
  • 模型推理
    1篇
  • 深度学习
    24篇
  • NLP
    25篇
  • pytorch
    24篇
  • transformer
    1篇
兴趣领域 设置
  • 人工智能
    pytorchnlp迁移学习
  • 最近
  • 文章
  • 代码仓
  • 资源
  • 问答
  • 帖子
  • 视频
  • 课程
  • 关注/订阅/互动
  • 收藏
搜TA的内容
搜索 取消

mnn推理示例

MNN环境配置首先可以通过官网提供的window,mac,linux版本运行库来配置自己的mnn环境 https://github.com/alibaba/MNN。或者可以自己下载最新的mnn源码根据 https://www.yuque.com/mnn/cn的官方文档来编译出最新的运行库来配置自己的mnn环境,文档中各种版本的编译都很详细,可以根据需要自行编译。MNN推理示例配置好环境,准备已经转换好的mnn模型之后开始推理#include "MNN/Interpreter.hpp"#incl
原创
发布博客 2021.12.27 ·
1821 阅读 ·
1 点赞 ·
0 评论 ·
1 收藏

win10下vs2019配置litorch

在配置过程自己遇到不少坑,跟着该博文一步步操作即可一遍成功!###1.下载libtorchhttps://pytorch.org/根据自己是否需要gpu版本和torch与cuda的版本号来选择性下载,最好选择对应的版本,不对应可能也没有问题(没试过)。可以在迅雷下载链接并更改自己需要的版本即可下载成功,比如这里的1.9改为1.7.1,我下载的是1.7.1+cu101。解压后可以看到这样的目录结构2.开始在vs2019下配置libtorch环境2.1新建一个项目,一定先切换 x86到x64。
原创
发布博客 2021.09.07 ·
612 阅读 ·
2 点赞 ·
0 评论 ·
5 收藏

nn.LSTM层出来的out和hn的关系

import torchimport torch.nn as nn单层lstmlstm = nn.LSTM(input_size=100, hidden_size=200, bidirectional=True, batch_first=True)a = torch.randn(32, 512, 100)out, (h, c) = lstm(a)print(out.shape) # 32, 512, 400print(h.shape) # 2, 32, 400print(out[0
原创
发布博客 2021.07.08 ·
798 阅读 ·
0 点赞 ·
3 评论 ·
2 收藏

bert预训练模型使用demo

下面是huggingface的bert文件API的调用及简单的使用demo,具体bert文本分类使用可以参考https://github.com/lyj157175/nlp_projectsfrom pytorch_pretrained import BertModel, BertTokenizerimport torchimport torch.nn as nn# 加载本地预训练模型文件,包括config.json, vocab.txt, pytorch_model.binbert = Be
原创
发布博客 2021.06.08 ·
645 阅读 ·
0 点赞 ·
0 评论 ·
1 收藏

文件的复制python

import shutilshutil.copy(src_path, tgt_path)src_path: 原文件路径tgt_path: 目标文件路径
原创
发布博客 2021.06.03 ·
85 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

图邻接表,BFS和DFS的python实现

图的邻接表实现class V: def __init__(self, item): self.id = item self.nbrs = {} self.visited = False def add_nbr(self, nbr, weight=0): self.nbrs[nbr] = weight def get_nbrs(self): return self.nbrs.keys
原创
发布博客 2021.03.30 ·
761 阅读 ·
1 点赞 ·
0 评论 ·
6 收藏

堆结构和堆排序原理及python实现

堆结构堆结构是一个完全二叉树,将数组中的数字在二叉树从上到下,从左到右进行排列。若每个父节点的值大于子节点的值则为大顶堆,若每个父节点的值小于子节点的值则为小顶堆。属性:对任意一个node为idx (idx=0为根节点)父节点:(idx-1)//2,左节点:(2idx + 1),右节点:(2idx + 2)父节点 >=子节点,根节点最大(大顶堆),反之小顶堆堆排序堆排序分为建堆和堆调整两个过程。建堆的时间复杂度为O(n),堆调整的时间复杂度为log(n),所以堆排序的时间复杂度为n
原创
发布博客 2021.03.29 ·
323 阅读 ·
1 点赞 ·
0 评论 ·
2 收藏

【pytorch模型实现12】文本匹配之DSSM

DSSM模型结构代码地址:https://github.com/lyj157175/Modelsimport torch import torch.nn as nnclass DSSM(nn.Module): def __init__(self, vocab_size, embedding_dim, dropout): super(DSSM, self).__init__() self.embed = nn.Embedding(vocab_size,
原创
发布博客 2021.03.09 ·
1885 阅读 ·
0 点赞 ·
0 评论 ·
10 收藏

【pytorch模型实现11】Bert及预训练任务

Bert模型BERT包括BertEmbedding和12层TransformerBlock组合而成。BertEmbedding包括TokenEmbedding,PositionalEmbedding,SegmentEmbedding三部分相加而成。TransformerBlock则是transformer的encoder部分。两个预训练任务Masked language modelNext Sentence Prediction Modelimport torchimport tor
原创
发布博客 2021.03.09 ·
1118 阅读 ·
0 点赞 ·
1 评论 ·
8 收藏

【pytorch模型实现10】Transformer

模型结构Positional EncodingFeed Forward
原创
发布博客 2021.03.04 ·
265 阅读 ·
0 点赞 ·
1 评论 ·
1 收藏

pytorch模型实现汇总

【pytorch模型实现1】Skip-Gram+Neghttps://blog.csdn.net/lyj223061/article/details/113849997【pytorch模型实现2】Glovehttps://blog.csdn.net/lyj223061/article/details/113850145【pytorch模型实现3】C2Whttps://blog.csdn.net/lyj223061/article/details/113850182【pytorch模型实现4】T.
原创
发布博客 2021.02.18 ·
661 阅读 ·
0 点赞 ·
0 评论 ·
2 收藏

【pytorch模型实现9】HAN_Attention

HAN_Attention模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torch import torch.nn as nn from torch.autograd import Variableimport numpy as np from torch.nn import functional as Fclass HAN_Attention(nn.Module): '''层次注意力网络文档分类模型实现
原创
发布博客 2021.02.18 ·
1830 阅读 ·
2 点赞 ·
4 评论 ·
9 收藏

【pytorch模型实现8】Seq2Seq + attention

Seq2Seq + attention模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torchimport torch.nn as nn from torch.autograd import Variableimport torch.nn.functional as Fimport numpy as np class Seq2Seq_attention(nn.Module): '''Bahdanau论文中
原创
发布博客 2021.02.18 ·
275 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

【pytorch模型实现7】Seq2Seq

Seq2Seq模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torchimport torch.nn as nn class Seq2Seq(nn.Module): def __init__(self, src_vocab_size, tgt_vocab_size, embedding_dim, hidden_size): super(Seq2Seq, self).__init__()
原创
发布博客 2021.02.18 ·
217 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

【pytorch模型实现6】FastText

FastText模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torch import torch.nn as nnclass FastText(nn.Module): def __init__(self, vocab_size, embedding_dim, max_len, num_label): super(FastText, self).__init__() self.
原创
发布博客 2021.02.18 ·
567 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

【pytorch模型实现5】ChartextCNN

ChartextCNN模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torchimport torch.nn as nn class ChartextCNN(nn.Module): '''6层卷积,3层全连接层''' def __init__(self, config): super(ChartextCNN, self).__init__() self.in_featu
原创
发布博客 2021.02.18 ·
410 阅读 ·
0 点赞 ·
0 评论 ·
1 收藏

【pytorch模型实现4】TextCNN

TextCNN模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torch import torch.nn as nn import torch.nn.functional as Fclass TextCNN(nn.Module): def __init__(self, config): super(TextCNN, self).__init__() self.max_seq_le
原创
发布博客 2021.02.18 ·
358 阅读 ·
0 点赞 ·
0 评论 ·
1 收藏

【pytorch模型实现3】C2W

C2W模型实现NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torchimport torch.nn as nn class C2W(nn.Module): def __init__(self, config): super(C2W, self).__init__() self.char_hidden_dim = config.char_hidden_dim self.w
原创
发布博客 2021.02.18 ·
219 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

【pytorch模型实现2】Glove

NLP模型代码github仓库:https://github.com/lyj157175/Modelsimport torchimport torch.nn as nnclass Glove(nn.Module): def __init__(self, vocab_size, embedding_dim, x_max, alpha): super(Glove, self).__init__() self.vocab_size = vocab_size
原创
发布博客 2021.02.18 ·
382 阅读 ·
0 点赞 ·
1 评论 ·
3 收藏

【pytorch模型实现1】Skip-Gram+Neg

Word2Vec原文 https://arxiv.org/pdf/1301.3781.pdfSkip-Gram+Neg模型实现NLP模型代码github仓库:https://github.com/lyj157175/Models'''Word2Vec模型包括:CBOW, Skip-Gram这里实现的是Skip-Gram + 负采样(NEG)模型'''import torchimport torch.nn as nnimport torch.nn.functional as Fcla
原创
发布博客 2021.02.18 ·
453 阅读 ·
0 点赞 ·
1 评论 ·
1 收藏
加载更多