随笔分类 - NLP
摘要:github: https://github.com/haibincoder/NlpSummary/tree/master/torchcode/classification 使用TextCNN实现文本分类 使用LSTM实现文本分类 使用Transformers实现文本分类 import copy f
阅读全文
摘要:github: https://github.com/haibincoder/NlpSummary/tree/master/torchcode/classification 使用TextCNN实现文本分类 使用LSTM实现文本分类 使用Transformers实现文本分类 import torch
阅读全文
摘要:github: https://github.com/haibincoder/NlpSummary/tree/master/torchcode/classification 使用TextCNN实现文本分类 使用LSTM实现文本分类 使用Transformers实现文本分类 # model # cod
阅读全文
摘要:问题 在清华新闻分类数据集上,使用TextCNN效果不错,使用TextLSTM/RNN学习不动,损失和acc均无变化 定位问题 CNN效果有提升,说明train代码和数据没问题; 更改RNN/LSTM结构,加损失函数还是没效果; 修改lr、embed_dim,num_laber均无效果; 本地一步步
阅读全文
摘要:信息熵 信息熵也被称为熵,用来表示所有信息量的期望。 公式如下: 例如在一个三分类问题中,猫狗马的概率如下: |label|猫|狗|马| |:--|:--|:--|:--| |predict|0.7|0.2|0.1| |信息量|-log(0.7)|-log(0.2)|-log(0.1)| 信息熵为:
阅读全文
摘要:预训练&搜索 背景 传统的Term字面匹配无法处理语义相关性,例如“英语辅导”、“新东方” 发展 2013 word2vec 优点:通过无监督学习获得词向量 缺点:无法处理多义词,上下文无关 2018 ELMo 结构:双层双向RNN 优点:上下文相关,动态生成词向量 2017 transformer
阅读全文
摘要:背景 使用pytorch加载huggingface下载的albert-base-chinede模型出错 Exception has occurred: OSError Unable to load weights from pytorch checkpoint file. If you tried
阅读全文
摘要:背景:云物理机没安装tf相关环境,需要使用docker直接跑模型 在docker hub下载一个tensorflow gpu镜像 运行docker,直接进入bash,使用nvidia-smi正常看到现存,然后正常跑代码即可 docker run -v /data/bert:/app --runtim
阅读全文
摘要:# 获取当前设备 device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
阅读全文
摘要:参考: Deep Joint Entity Disambiguation with Local Neural Attention. (Ganea and Hofmann, 2017, EMNLP) DeepType: multilingual entity linking by neural typ
阅读全文
摘要:postmant请求 { "signature_name":"get_result", "inputs":{ "dropout_keep_prob": 1.0, "q1": [[3, 12, 30, 20], [3, 12, 30, 20]], "q1_len": [4, 4], "q2": [[3
阅读全文
摘要:目的: L1和L2正则都可以解决过拟合 方法: L1正则:向量中各个元素绝对值的和,适用于稀疏特征。原理:直接删除异常特征,解决过拟合。 缺点:绝对值不可求导,需要特殊处理。 L2正则:向量中各元素平方和求平方根,使用场景更多,计算方便。原理:将异常特征平均化。 图像: L1是蓝色的线,L2是红色的
阅读全文
摘要:
阅读全文
摘要:tfserving模型部署见:https://www.cnblogs.com/bincoding/p/13266685.html demo代码:https://github.com/haibincoder/tf_tools 对应restful入参: { "inputs": { "input": [[
阅读全文
摘要:问题背景:python通过grpc调用tfserving报错, 提示:AttributeError: module 'tensorflow_serving.apis.prediction_service_pb2' has no attribute 'beta_create_PredictionSer
阅读全文
摘要:官网:https://tensorflow.google.cn/tfx/guide/serving 步骤1:保存pb模型 # 为模型每一个参数添加name # ner demo: https://github.com/buppt/ChineseNER self.input_x = tf.placeh
阅读全文
摘要:
阅读全文
摘要:的研究中,深度学习也获得了不错的效果。最近,笔者阅读了一系列基于深度学习的NER研
阅读全文