Comments (7)
Could you please tell me to generate yelp_academic_dataset_review.json?
from hierarchical-attention-networks.
Could you please tell me how to generate yelp_academic_dataset_review.json?
from hierarchical-attention-networks.
@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:
python3 yelp_prepare.py yelp_academic_dataset_review.json
from hierarchical-attention-networks.
Thanks a lot.I have done it.When I use the code :
python3 worker.py --mode=eval
There is a erro:
File "worker.py", line 211, in
main()
File "worker.py", line 208, in main
evaluate(task.read_devset(epochs=1))
File "worker.py", line 142, in evaluate
model, _ = model_fn(s, restore_only=True)
File "worker.py", line 87, in HAN_model_1
is_training=is_training,
File "/home/bfs/Myy/NN/HATTdeep-text-classifier-master/HAN_model.py", line 64, in init
self._init_embedding(scope)
File "/home/bfs/Myy/NN/HATTdeep-text-classifier-master/HAN_model.py", line 101, in _init_embedding
dtype=tf.float32)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 988, in get_variable
custom_getter=custom_getter)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 890, in get_variable
custom_getter=custom_getter)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 348, in get_variable
validate_shape=validate_shape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 333, in _true_getter
caching_device=caching_device, validate_shape=validate_shape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 684, in _get_single_variable
validate_shape=validate_shape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 197, in init
expected_shape=expected_shape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 315, in _init_from_args
self._snapshot = array_ops.identity(self._variable, name="read")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1490, in identity
result = _op_def_lib.apply_op("Identity", input=input, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2327, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1226, in init
self._traceback = _extract_stack()
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value tcm/embedding/embedding_matrix
[[Node: tcm/embedding/embedding_matrix/read = IdentityT=DT_FLOAT, _class=["loc:@tcm/embedding/embedding_matrix"], _device="/job:localhost/replica:0/task:0/cpu:0"]]
How do you deal with it?
from hierarchical-attention-networks.
@maoyanying I did not encounter such an error. Check python and tensorflow version, works for me on python 3.5
and tensorflow 1.2
.
from hierarchical-attention-networks.
@MtDersvan Have you implemented it yet? I'm interested in implementing it recently.
from hierarchical-attention-networks.
Hi @gaussic ! Sorry for the late reply!
I don't think it was meant by tensorflow core team for that, I have asked them but to no avail(
So, I just implemented it in tensorflow without new seq2seq
API.
It's actually quite easy:
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
from hierarchical-attention-networks.
Related Issues (20)
- some error in yelp_prepare.py HOT 4
- ValueError in running worker.py HOT 12
- How to make `TensorBoard Projector` work.
- Why use orthogonal_initializer ?
- Error While Running yelp_prepare.py HOT 3
- Is the embedding initialized with a pre-trained one? HOT 2
- GRU VS LSTM HOT 1
- Are uw and us global weights? just to conform. HOT 1
- Mask for attention weight
- Getting same sentence level outputs for very different documents. Can someone please help.
- Embeddings for special tokens/padding?
- dev accuracy: nan???
- en-core-web-sm needs to be installed beforehand
- Same cell for word and sentence level HOT 3
- Performance on the paper's dataset HOT 6
- Won't the code leads to different input shape for different batch?
- Visualize word and sentence attention weight as color coded in the paper HOT 1
- Performance on Yelp 15
- Attention layer output HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hierarchical-attention-networks.