mem_absa
mem_absa copied to clipboard
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
Hey there, I have re-implemented this paper and achieved the exact same results. I also solved the problem which was resulting in this code being 5X slower. Check out my repo, the way to run that code is same as this one. https://github.com/Humanity123/MemNet_ABSA
@Humanity123 I have downloaded your program and run it, but I also get the same issue about "absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'pad_idx' ", what is the version of tensorflow on your program?
@Aron9080 Tensorflow Version - 1.4.1
@Humanity123 Thank you so much, the program is running.
@Humanity123 Did you read a paper ‘Deep Learning for Aspect-Based Sentiment Analysis’, which is impressed by the high accuracy of the sentiment model.
@Aron9080 No I didn't.
@Humanity123 How much is the accuracy of this model? I am currently doing my final year project which is about rating quality of restaurants automatically through text comments of their customer, but I have no idea to build a good sentiment model with high accuracy.
@Aron9080 This should give accuracy around 72%
@Humanity123 I got the accuracy of 63%, which means that the Neural Network is not best in this model, I should re-run the program to build a high accuracy model? Otherwise, did you think that it can improve the accuracy by Data normalised?
@Humanity123 I am sorry to bother you, but I am confusing about the accuracy, as you mentioned that this model will give an accuracy around 72%. However, I try to modify the parameters of the model, but there does not give a high accuracy with me. Did I miss the special parameters?
@Aron9080 Try removing the clipping on gradients.
@Humanity123 Hi, I have some questions about aspect based sentiment analysis by using memory neural network, which is that how can I get the aspect of a sentence after analysis by the model. I hope that you can give me some feedback. Thanks.
@Aron9080 Hi, I believe for the task of Aspect Based Sentiment Analysis the aspect word is always provided. Can you be more specific as to what is that you want.
@Humanity123 Yes, the aspect word is provided with the dataset, but I just confuse that how to extract the aspect from user's input by using this model? I think that I should build a new program of the aspect extraction since this ABSA model is to analyze the polarity of the aspect.
@Humanity123 I am trying this code in Tensorflow on Windows. I am working on Anaconda environment. Your github linked helped me. I was facing issues to make this code running. But your code I could run with some minor modifications on windows. Thanks for your link.
Hey there, I have re-implemented this paper and achieved the exact same results. I also solved the problem which was resulting in this code being 5X slower. Check out my repo, the way to run that code is same as this one. https://github.com/Humanity123/MemNet_ABSA
Hey @Humanity123 I just came across this thread, and downloaded your repo. I too am getting the same Unknown command line flag 'pad_idx'
error as I got in the repo of @ganeshjawahar. I am running tf 1.8.0.
If I comment that line, I get the same error with flag nwords
. If I comment that line as well, the same error with some other keyword that's supposed to be in FLAGS
. And so on.
I think these flags were probably defined in TF v1.4.1, but may have been removed in subsequent versions. The fix that worked for me is to add the following lines to define the tags causing the errors:
flags.DEFINE_string('pad_idx', '', 'kernel')
flags.DEFINE_string('nwords', '', 'kernel')
flags.DEFINE_string('mem_size', '', 'kernel')
flags.DEFINE_string('pre_trained_context_wt', '', 'kernel')
flags.DEFINE_string('pre_trained_target_wt', '', 'kernel')
After this got fixed, the error I get is the following:
training...
epoch 0...
[?25lTrain
[?25hTraceback (most recent call last):
File "main.py", line 70, in <module>
tf.app.run()
File "C:\Users\h473\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
_sys.exit(main(argv))
File "main.py", line 67, in main
model.run(train_data, test_data)
File "C:\Users\h473\Documents\Sentiment Analysis\MemNet_ABSA\model.py", line 246, in run
train_loss, train_acc = self.train(train_data)
File "C:\Users\h473\Documents\Sentiment Analysis\MemNet_ABSA\model.py", line 180, in train
_, train_acc = self.test(data)
File "C:\Users\h473\Documents\Sentiment Analysis\MemNet_ABSA\model.py", line 237, in test
return cost, acc/float(len(source_data))
ZeroDivisionError: float division by zero
It seems the source_data
is empty. And that's because:
train data size - 0
test data size - 43
Is there some problem reading the seg
files, like Laptops_Test_Gold.xml.seg
?
@Aron9080 ,Hello, I met the same problem with you, how did you solve it?