Giter VIP home page Giter VIP logo

mem_absa's People

Contributors

ganeshjawahar avatar humanity123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mem_absa's Issues

TypeError: Expected int32, got list containing Tensors of type '_Message' instead. on tf1.4

mldl@ub1604:/ub16_prj/mem_absa$ python2 main.py --show True
/usr/local/lib/python2.7/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Read 2358 aspects from data/Laptop_Train_v2.xml
Read 654 aspects from data/Laptops_Test_Gold.xml
{'batch_size': 128,
'edim': 300,
'init_hid': 0.1,
'init_lr': 0.01,
'init_std': 0.05,
'lindim': 75,
'max_grad_norm': 50,
'mem_size': 78,
'nepoch': 100,
'nhop': 7,
'nwords': 7144,
'pad_idx': 0,
'pretrain_file': 'data/glove.6B.300d.txt',
'show': True,
'test_data': 'data/Laptops_Test_Gold.xml',
'train_data': 'data/Laptop_Train_v2.xml'}
loading pre-trained word vectors...
2018-09-25 12:09:09.418188: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-09-25 12:09:09.475310: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-09-25 12:09:09.475614: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GTX 950M major: 5 minor: 0 memoryClockRate(GHz): 1.124
pciBusID: 0000:01:00.0
totalMemory: 3.95GiB freeMemory: 3.67GiB
2018-09-25 12:09:09.475635: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 950M, pci bus id: 0000:01:00.0, compute capability: 5.0)
Traceback (most recent call last):
File "main.py", line 61, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "main.py", line 57, in main
model.build_model()
File "/home/mldl/ub16_prj/mem_absa/model.py", line 107, in build_model
self.build_memory()
File "/home/mldl/ub16_prj/mem_absa/model.py", line 79, in build_memory
a_til_concat = tf.concat(2, [til_hid3dim, Ain])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1096, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 836, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 926, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 229, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 208, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 383, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 303, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
mldl@ub1604:
/ub16_prj/mem_absa$

questions about the procedure of test()

In the method "test" in model.py, it seems that there is a module about training the model using the test data.(from line 236 to 244 ).
I wonder why we should use test golden label here and in line 230, is it used as a validation ?
I'm new in tensorflow, please pardon me if there were errors in my understanding.

Resource exhaustion error

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[128,78,600]
[[Node: concat_12 = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](Reshape_37, Add, concat_12/axis)]]
[[Node: Reshape_45/_143 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_326_Reshape_45", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]

The memory usuage blows up even with an extremely powerful GPU cluster on aws i.e. 64 Gb of GPU memory. The original MemN2N code that this repo is derived from doesn't suffer from this problem so I assume this is a bug.

The bug of Unknown command line flag 'pad_idx'

Hi, I have met the below error when the program was run, how to fix it?

Traceback (most recent call last):
File "main.py", line 63, in
tf.app.run()
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "main.py", line 47, in main
FLAGS.pad_idx = source_word2idx['']
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/flags.py", line 88, in setattr
return self.dict['__wrapped'].setattr(name, value)
File "/Library/Python/2.7/site-packages/absl/flags/_flagvalues.py", line 496, in setattr
return self._set_unknown_flag(name, value)
File "/Library/Python/2.7/site-packages/absl/flags/_flagvalues.py", line 374, in _set_unknown_flag
raise _exceptions.UnrecognizedFlagError(name, value)
absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'pad_idx'

Training Fails on Laptop Dataset

When I try to train using the recommended Glove 300D vectors and on the Laptop Dataset as stated in the README the following error occurs:
"Traceback (most recent call last):
File "main.py", line 61, in
tf.app.run()
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "main.py", line 57, in main
model.build_model()
File "/Users/joey/Desktop/marketanalytics/mem_absa/model.py", line 107, in build_model
self.build_memory()
File "/Users/joey/Desktop/marketanalytics/mem_absa/model.py", line 79, in build_memory
a_til_concat = tf.concat(2, [til_hid3dim, Ain])
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1029, in concat
dtype=dtypes.int32).get_shape(
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 639, in convert_to_tensor
as_ref=False)
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 704, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 370, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/Users/joey/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead."

about the data

i want to know the data in this project is the data of Semeval 2014 or the data of Semeval 2016.

Predicting on trained model

Can you elaborate a little bit on how I can use trained model to predict my own data? Also I can't find weights file (saved model) after training proccess. Little tutorial would be really helpful. Thanks.

Aspect Extraction

@ganeshjawahar
Hi, I have some questions about aspect based sentiment analysis by using memory neural network, which is that how can I extract the aspect of a sentence after analysis by the model. I hope that you can give me some feedback. Thanks.

This code acc != source paper acc

Thx your code. But when i use this code in restaurant dataset, i run 100 epochs and got 70% acc.
Here is my hyper-parameters:
'batch_size': 1,
'edim': 300,
'init_hid': 0.1,
'init_lr': 0.01,
'init_std': 0.01,
'lindim': 100,
'max_grad_norm': 100,
'mem_size': 83,
'nepoch': 320,
'nhop': 9,
'nwords': 3066,
'pad_idx': 0,
'pretrain_embeddings': 'glove.840B.300d.txt',
'show': True,

I know something is wrong, but i cant fix it.
For example, increase batch_size but i got less than 20% accuracy. And i change the number of hops but nothing happen.

issue with the api use

att = tf.batch_matmul(a_til_concat, til_bl_3dim, adj_y = True)

Hello, I am running the code in Windows10.
And I met a error in this line.
Below is the error report

Traceback (most recent call last):
  File "main.py", line 76, in <module>
    tf.app.run()
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 72, in main
    model.build_model()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 107, in build_model
    self.build_memory()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 82, in build_memory
    att = tf.batch_matmul(a_til_concat, til_bl_3dim, adj_y = True)
AttributeError: module 'tensorflow' has no attribute 'batch_matmul'

I try to change the batch_matmul to matmul based on this issue of tf
Then I met this error below.

Traceback (most recent call last):
  File "main.py", line 76, in <module>
    tf.app.run()
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 72, in main
    model.build_model()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa-master\model.py", line 107, in build_model
    self.build_memory()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa-master\model.py", line 82, in build_memory
    att = tf.matmul(a_til_concat, til_bl_3dim, adj_y = True)
TypeError: matmul() got an unexpected keyword argument 'adj_y'

So I delete 'adj_y',now the line has changed like below.

att = tf.matmul(a_til_concat, til_bl_3dim)

This is the Traceback info.

Traceback (most recent call last):
  File "main.py", line 76, in <module>
    tf.app.run()
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 72, in main
    model.build_model()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 107, in build_model
    self.build_memory()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 82, in build_memory
    att = tf.matmul(a_til_concat, til_bl_3dim)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\ops\math_ops.py", line 1814, in matmul
    a, b, adj_x=adjoint_a, adj_y=adjoint_b, name=name)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 337, in _batch_mat_mul
    adj_y=adj_y, name=name)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op
    op_def=op_def)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2632, in create_op
    set_shapes_for_outputs(ret)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1911, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1861, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 595, in call_cpp_shape_fn
    require_shape_fn)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 659, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Dimensions must be equal, but are 100 and 1 for 'MatMul' (op: 'BatchMatMul') with input shapes: [128,78,100], [128,1,100].

Do you have any idea to deal with this error?
Coud you please tell me the develop-environment and configure of your repository?
Thands a lot.

Task Definition

Hi @ganeshjawahar,

I would like to ask about task definition for this program. Is it want to infer the polarity of aspect category or aspect term?

Thank you.

IndexError: index out of bounds

I'm getting the following error. Does anybody else have this problem?
Python 3.6 on Windows.

 File "main.py", line 61, in <module>
    tf.app.run()
  File "C:\Users\Ferdinand\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 58, in main
    model.run(train_data, test_data)
  File "D:\dev\mem_absa\model.py", line 264, in run
    train_loss, train_acc = self.train(train_data)
  File "D:\dev\mem_absa\model.py", line 175, in train
    m = rand_idx[cur]
IndexError: index 2358 is out of bounds for axis 0 with size 2358

Crash during training

Hi @ganeshjawahar,

i got experienced that the script always got killed after seven iterations automatically. Not sure what's happening. do you have any idea why?

error

About Location Attention....

Hi @ganeshjawahar
i have looked your code in model.py since reading Tang's paper but i don't understand the calculation about location attention definitely. could you please tell something about your implementation (lines 56-57) in your code? Thanks.

Regarding results

Hi,

I was wondering if you managed to get any results close to the paper with this repository?

I downloaded the code and seem to get way worst results from the paper. Is it because of the unreported hyperparameters?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.