原创 2018國外大廠AI面試題

AI專業應屆畢業生年薪40萬的消息,大家都看到了吧?禪師這裏給大家來一個比較直觀的對比:   這張圖雖然有些年頭了,但不妨礙我們拿來做參考。再結合當前的環境,十分耐人尋味。 根據新智元報道,中國有12113個AI崗位空缺。 企業缺人是真

原创 【python】keras中的batch_gather

按index索引選擇序列中的值 例如: import tensorflow as tf seq = [1,2,3] idxs = [2] a = K.tf.batch_gather(seq, idxs) with tf.Session

原创 【pytorch】如何更新模型父類參數

更新方法例子如下: import torch import torch.nn as nn class A(nn.Module): def __init__(self): super(A,self).__init_

原创 【pytorch】pytorch中的state_dict解讀

在pytorch中,torch.nn.Module模塊中的state_dict變量存放訓練過程中需要學習的權重和偏執係數,state_dict作爲python的字典對象將每一層的參數映射成tensor張量。 import torch.n

原创 【python】python Ordereddict與dict區別

原文鏈接:https://www.cnblogs.com/zoujl/p/10910578.html 1、而使用OrderedDict時我們需要從collections模塊引入OrderedDi

原创 【python】利用traceback輸出詳細報錯信息

import traceback try: a=int('asdf') except Exception as e: print(traceback.format_exc()) 輸出: Traceback (most

原创 【NLP】Gelu高斯誤差線性單元解釋

原文鏈接:https://blog.csdn.net/liruihongbob/article/details/86510622 Gaussian Error Linerar Units(GEL

原创 【pytorch】pytorch 計算 CrossEntropyLoss 需要先經 softmax 層激活嗎

原文鏈接:https://www.jianshu.com/p/e184663e2f8a 答案是 不需要。 碰到一個坑,之前用 pytorch 實現自己的網絡時,如果使用CrossEntropyL

原创 【python】torch.tensor 和 Tensor區別

Tensor是python類,tensor是python函數,區別在於默認的數據類型不一樣。 >>> a=torch.Tensor([1,2]) >>> print(a) tensor([1., 2.]) >>> a.type() 'to

原创 【NLP】Bert預訓練中Mask LM和Next Sentence Prediction輸入輸出是什麼形式?

1. Mask LM的輸入輸出形式: input :  [CLS] I like [MASK]  (原始句子:I like cat) ouput: C h1 h2 h3 對h3增加一層所有詞的softmax,預測其輸出是否爲cat。  

原创 【python】pytorch中的detach是什麼功能

detach的方法,將variable參數從網絡中隔離開,不參與參數更新。 如下: # y=A(x), z=B(y) 求B中參數的梯度,不求A中參數的梯度 y = A(x) z = B(y.detach()) z.backward()

原创 【NLP】Bert base和 Bert large參數對比

Bert base的網絡結構: L(網絡層數)=12, H(隱藏層維度)=768, A(Attention 多頭個數)=12, Total Parameters= 12*768*12=110M 使用GPU內存:7G多 Bert base的

原创 【NLP】什麼是知識圖譜?

知識圖譜是一種基於圖的數據結構,由點和邊組成,點代表實體,邊代表關係,點上有屬性。

原创 【NLP】bert中的[CLS]甚意思?

bert論文中提到:“GPT uses a sentence separator ([SEP]) and classifier token ([CLS]) which are only introduced at fine-tuning

原创 【NLP】ACL-2019 錄用論文

LONG PAPERS (MAIN CONFERENCE) SphereRE: Distinguishing Lexical Relations with Hyperspherical Relation EmbeddingsChengyu