Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Conversation

@wangxiao1021
Copy link
Contributor

No description provided.


def download(url, filename, md5sum):
"""
Download file and check md5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否可以使用现有 download.py 中的 get_path_from_url

self._encoder = CNNEncoder(
dict_size=self.dict_dim + 1,
emb_dim=self.emb_dim,
seq_len=self.seq_len,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看到这里需要设置seq_len,固定的seq_len对于可能会有些问题,这个的话是CNNEncoder这个API导致的,已经和 @jinyuKING 去更新 #60 中的这个接口了,后面可能还要麻烦再调整下。

emb_dim=self.emb_dim,
padding_idx=None,
bow_dim=self.hid_dim,
seq_len=self.seq_len)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,已经和 @jinyuKING 去更新 #60 中的这个接口了,后面可能还要麻烦再调整下

self._fc_prediction = Linear(input_dim=self.fc_hid_dim,
output_dim=self.class_dim,
act="softmax")
self._encoder = GRUEncoder(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#60 中加的这个接口后面会去掉,对于GRU和LSTM后面各提供一个统一的接口,GRU的话可以使用下面BiGRU中一样的接口


def forward(self, inputs):
emb = self.embedding(inputs)
emb = fluid.layers.reshape(emb, shape=[self.batch_size, -1, self.hid_dim])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类似seq_len,batch_size最后也要支持不同batch间可变,尽量不要固定。这里的话如果inputs[batch_size, seq_len]的形状的话应该就不需要这个reshape和batch_size的引入了

emb_dim=self.emb_dim,
lstm_dim=self.hid_dim,
hidden_dim=self.hid_dim,
seq_len=self.seq_len,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LSTMEncoder的话 #60 中加的这个接口后面也会调整,对于GRU和LSTM后面各提供一个统一的接口,还要麻烦后面再调整下

from paddle.io import DataLoader


class EmoTectProcessor(object):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议使用新的 Dataset + BatchSampler + DataLoader 的数据读入方式,可以参考这里 https://github.com/PaddlePaddle/hapi/blob/master/hapi/text/bert/dataloader.py#L162 。时间紧急的话可以后续考虑

def __init__(self, dict_dim, seq_len):
super(GRU, self).__init__()
self.dict_dim = dict_dim
self.emb_dim = 128
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议参数尽量可配置,可以后续考虑

self.class_dim = 3
self.seq_len = seq_len
self._fc1 = Linear(input_dim=self.hid_dim, output_dim=self.fc_hid_dim, act="tanh")
self._fc_prediction = Linear(input_dim=self.fc_hid_dim,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看CNN、BOW和下面的LSTM中几个中也都是包含了_fc1, _fc_prediction, 后续可以考虑把不同特征提取部分抽出来

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants