hsqmlzno1 / HATN

Hierarchical Attention Transfer Network for Cross-domain Sentiment Classification (AAAI'18)
MIT License
83 stars 24 forks source link

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

Open yuanyuansiyuan opened 6 years ago

yuanyuansiyuan commented 6 years ago

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!

hsqmlzno1 commented 6 years ago

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

yuanyuansiyuan commented 6 years ago

But i still get the same error.

haoyanbin918 commented 6 years ago

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.

hsqmlzno1 commented 6 years ago

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

yuanyuansiyuan commented 6 years ago

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'

haoyanbin918 commented 6 years ago

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'

hsqmlzno1 commented 6 years ago

What's the version of Tensorflow?

yuanyuansiyuan commented 6 years ago

tensorflow 1.10.1 tensorflow-gpu 1.4

yuanyuansiyuan commented 6 years ago

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

haoyanbin918 commented 6 years ago

tensorflow 1.11.0

hsqmlzno1 commented 6 years ago

OK. I think the version is old.

haoyanbin918 commented 6 years ago

Ok, I will upgrade it. Thanks.

haoyanbin918 commented 6 years ago

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

hsqmlzno1 commented 6 years ago

Maybe appropriate version is fine.

haoyanbin918 commented 6 years ago

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 valacc, = 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()

yuanyuansiyuan commented 6 years ago

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

haoyanbin918 commented 6 years ago

It is work now. Many thanks.