From 42b621956e9194a44dbb0d10d35c5bc91c9514bb Mon Sep 17 00:00:00 2001 From: ChenXin Date: Wed, 25 Sep 2019 18:26:40 +0800 Subject: [PATCH] maybe we should add r before all """ beginnings --- fastNLP/io/loader/matching.py | 19 ++++++++++++------- fastNLP/modules/encoder/attention.py | 3 +-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fastNLP/io/loader/matching.py b/fastNLP/io/loader/matching.py index bf4eec81..77dcb521 100644 --- a/fastNLP/io/loader/matching.py +++ b/fastNLP/io/loader/matching.py @@ -450,21 +450,26 @@ class BQCorpusLoader(Loader): class LCQMCLoader(Loader): - """ - 别名: + r""" 数据集简介:句对匹配(question matching) + 原始数据为: - '喜欢打篮球的男生喜欢什么样的女生\t爱打篮球的男生喜欢什么样的女生\t1\n' - '晚上睡觉带着耳机听音乐有什么害处吗?\t孕妇可以戴耳机听音乐吗?\t0\n' - 读取后的Dataset将具有以下的数据结构: - + + .. code-block:: text + + '喜欢打篮球的男生喜欢什么样的女生\t爱打篮球的男生喜欢什么样的女生\t1\n' + '晚上睡觉带着耳机听音乐有什么害处吗?\t孕妇可以戴耳机听音乐吗?\t0\n' + + 读取后的Dataset将具有以下的数据结构 + .. csv-table:: :header: "raw_chars1", "raw_chars2", "target" "喜欢打篮球的男生喜欢什么样的女生?", "爱打篮球的男生喜欢什么样的女生?", "1" "晚上睡觉带着耳机听音乐有什么害处吗?", "妇可以戴耳机听音乐吗?", "0" "...", "...", "..." - + + """ def __init__(self): diff --git a/fastNLP/modules/encoder/attention.py b/fastNLP/modules/encoder/attention.py index fdfcf0fd..b48be579 100644 --- a/fastNLP/modules/encoder/attention.py +++ b/fastNLP/modules/encoder/attention.py @@ -152,8 +152,7 @@ class BiAttention(nn.Module): :param torch.Tensor premise_mask: [batch_size, a_seq_len] :param torch.Tensor hypothesis_batch: [batch_size, b_seq_len, hidden_size] :param torch.Tensor hypothesis_mask: [batch_size, b_seq_len] - :return: torch.Tensor attended_premises: [batch_size, a_seq_len, hidden_size] - torch.Tensor attended_hypotheses: [batch_size, b_seq_len, hidden_size] + :return: torch.Tensor attended_premises: [batch_size, a_seq_len, hidden_size] torch.Tensor attended_hypotheses: [batch_size, b_seq_len, hidden_size] """ similarity_matrix = premise_batch.bmm(hypothesis_batch.transpose(2, 1) .contiguous())