fastNLP.models.snli module

class fastNLP.models.snli.ESIM(embed, hidden_size=None, num_labels=3, dropout_rate=0.3, dropout_embed=0.1)[源代码]

基类:fastNLP.models.base_model.BaseModel

基类 fastNLP.models.BaseModel

别名 fastNLP.models.ESIM fastNLP.models.snli.ESIM

ESIM model的一个PyTorch实现 论文参见: https://arxiv.org/pdf/1609.06038.pdf

__init__(embed, hidden_size=None, num_labels=3, dropout_rate=0.3, dropout_embed=0.1)[源代码]
参数
  • embed – 初始化的Embedding

  • hidden_size (int) – 隐藏层大小,默认值为Embedding的维度

  • num_labels (int) – 目标标签种类数量,默认值为3

  • dropout_rate (float) – dropout的比率,默认值为0.3

  • dropout_embed (float) – 对Embedding的dropout比率,默认值为0.1

forward(words1, words2, seq_len1, seq_len2, target=None)[源代码]
参数
  • words1 – [batch, seq_len]

  • words2 – [batch, seq_len]

  • seq_len1 – [batch]

  • seq_len2 – [batch]

  • target

返回

training: bool