-
Notifications
You must be signed in to change notification settings - Fork 146
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
Implementation using tf.contrib.seq2seq. #7
Comments
Could you please tell me to generate yelp_academic_dataset_review.json? |
Could you please tell me how to generate yelp_academic_dataset_review.json? |
@maoyanying you need to register and download the dataset from here https://www.yelp.com/dataset_challenge. After, use the code in the README to launch the data prep:
|
Thanks a lot.I have done it.When I use the code : FailedPreconditionError (see above for traceback): Attempting to use uninitialized value tcm/embedding/embedding_matrix How do you deal with it? |
@maoyanying I did not encounter such an error. Check python and tensorflow version, works for me on |
@MtDersvan Have you implemented it yet? I'm interested in implementing it recently. |
Hi @gaussic ! Sorry for the late reply! def attention_reduction(self,
inputs,
output_size,
initializer=tf.contrib.layers.xavier_initializer(),
activation_fn=tf.tanh,
scope=None):
with tf.variable_scope(scope or 'Attention_Reduction') as scope:
attention_context_vector = tf.get_variable(
name='attention_context_vector',
shape=[output_size],
initializer=initializer,
dtype=tf.float32)
input_projection = tf.contrib.layers.fully_connected(
inputs,
output_size,
activation_fn=activation_fn,
scope=scope)
vector_attention = tf.reduce_sum(
tf.multiply(input_projection, attention_context_vector),
axis=2,
keep_dims=True)
attention_weights = tf.nn.softmax(vector_attention, dim=1)
weighted_projection = tf.multiply(input_projection, attention_weights)
outputs = tf.reduce_sum(weighted_projection, axis=1)
return outputs, attention_weights |
Hi, your
Hierarchical Attention Networks for Document Classification (Yang et al., 2016)
implementation looks very good, especially after bug fixes, nice work!I wonder what it would take to reimplement your HANs with the new
tf.contrib.seq2seq
API (> r.1.2). There are some examples how to do encoder-decoder attention withseq2seq
, but no examples of pure encoding ('reducing') attention.Thank you very much!
The text was updated successfully, but these errors were encountered: