Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modeling layer of BiDAF #11

Open
wants to merge 2 commits into
base: bidaf
Choose a base branch
from

Conversation

Ishitori
Copy link

Description

Add modeling layer of BiDAF: just 2-layer bi-LSTM and mimic data input from attention flow.

Checklist

Essentials

  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented

Changes

  • Add modeling layer of BiDAF

Copy link
Owner

@cgraywang cgraywang left a comment

Choose a reason for hiding this comment

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

Thanks

def __init__(self, prefix=None, params=None):
super(BiDAFModelingLayer, self).__init__(prefix=prefix, params=params)

self._modeling_layer = LSTM(hidden_size=100, num_layers=2, bidirectional=True)
Copy link
Owner

Choose a reason for hiding this comment

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

Can you specify the input_size to be 8*hidden_size=800, and add description?

Copy link
Owner

Choose a reason for hiding this comment

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

Can you specify the dropout=0.2 according to the paper?

Copy link
Owner

Choose a reason for hiding this comment

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

Can you set hidden_size=input_dim, and num_layer=nlayers, bidirectional=biflag? It will be more general.


layer = BiDAFModelingLayer()
# The model doesn't need to know the hidden states, so I don't hold variables for the states
layer.initialize(init.Xavier(magnitude=2.24))
Copy link
Owner

Choose a reason for hiding this comment

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

Use the default layer.initialize() which is default by Uniform

Copy link
Owner

@cgraywang cgraywang left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants