hsqmlzno1 / HATN

Hierarchical Attention Transfer Network for Cross-domain Sentiment Classification (AAAI'18)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'train'

yuanyuansiyuan opened this issue · comments

when i use the commdand 'python extract_pivots.py --train --test -s dvd [source_domain] -t electronics [target_domain] -v [verbose]', this kind of command line lag unknown error occurs. Can you give some guide to fix it? Thank you!

python extract_pivots.py --train --test -s dvd -t electronics -v
[] are just descriptions.

But i still get the same error.

I also met this error. When running: python train_hatn.py --train --test -s book -t dvd -v, an error "absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'train' " occurs. Could you please help to fix it? Many thanks.

Could you give me more information? Which line the error occurs in?

Here is the error info

Traceback (most recent call last):
File "extract_pivots.py", line 12, in
np.random.seed(FLAGS.random_seed)
File "/home/cbd109/.local/lib/python2.7/site-packages/tensorflow/python/platform/flags.py", line 84, in getattr
wrapped(_sys.argv)
File "/home/cbd109/.local/lib/python2.7/site-packages/absl/flags/_flagvalues.py", line 632, in call
name, value, suggestions=suggestions)
absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'train'

Could you give me more information? Which line the error occurs in?
Here it is.
File "train_hatn.py", line 15, in
File "/home/robin/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/flags.py", line 84, in getattr
wrapped(_sys.argv)
File "/home/robin/anaconda2/lib/python2.7/site-packages/absl/flags/_flagvalues.py", line 632, in call
name, value, suggestions=suggestions)
absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'train'

What's the version of Tensorflow?

tensorflow 1.10.1 tensorflow-gpu 1.4

i upgrade tensorflow to 1.4, its ok now. Thank you!

OK. I think the version is old.

Ok, I will upgrade it. Thanks.

While the version 1.11.0 is very new, much newer than 1.4.0. Because it is too new?

Maybe appropriate version is fine.

Hi, I meet another error when runing "python train_hatn.py --train --test -s books -t dvd -v". Could you please help check it, thanks.
Traceback (most recent call last):
File "train_hatn.py", line 141, in
val_acc, _ = model.eval_sen(sess, x_val, word_mask_val, sent_mask_val, y_val, batch_size=FLAGS.batch_size)
File "/home/yanbin/CDSC_TKDE/HATN/models/hatn.py", line 153, in eval_sen
xb, wmb, smb = batch_generator.next_batch()
File "/home/yanbin/CDSC_TKDE/HATN/models/nn_utils.py", line 129, in next_batch
if self.word_mask != None:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

change the "if self.word_mask != None" to "if self.word_mask is not None:". I just search web to find this answer.

It is work now. Many thanks.