graykode / graykode/nlp-tutorial
Bi-LSTM attention calc may be wrong
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 14.9k
- Fork
- 3.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
# lstm_output : [batch_size, n_step, n_hidden * num_directions(=2)], F matrix
def attention_net(self, lstm_output, final_state):
batch_size = len(lstm_output)
hidden_forward=final_state[0]
hidden_backward=final_state[1]
hidden_f_b=torch.cat((hidden_forward, hidden_backward), 1)
hidden = hidden_f_b.view(batch_size, -1, 1) #
hidden = final_state.view(batch_size, -1, 1) # this line in source code is wrong, bi-lstm's hidden is[2,batch,embed_size] ,we need to concatenate forward and backward hidden state. if we final_state.view(batch_size, -1, 1) the hidden state is not concatenate by final_state[0][0] and final_state[1][0]
Hướng dẫn đóng góp
Hướng nghiên cứu
Inspect the notebook code containing attention_net and compare the two hidden-state constructions shown in the issue. Verify the Bi-LSTM tensor shapes and forward/backward state ordering, then rerun the relevant attention path to confirm the corrected calculation behaves as intended.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- jupyter-notebook, python
- Lĩnh vực
- machine-learning
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100