seq2seq icon indicating copy to clipboard operation
seq2seq copied to clipboard

Error in pipeline unittest after setup

Open mbehrooz opened this issue 7 years ago • 13 comments

I initially encountered Bernoulli and Categorical import errors. I fixed that by doing the solutions in #285. But now I get a new error: (I have tf 1.5.0 rc-1)

====================================================================== ERROR: test_train_infer (seq2seq.test.pipeline_test.PipelineTest) Tests training and inference scripts.


Traceback (most recent call last): File "/home/morteza/seq2seq/seq2seq/seq2seq/test/pipeline_test.py", line 76, in test_train_infer _clear_flags() File "/home/morteza/seq2seq/seq2seq/seq2seq/test/pipeline_test.py", line 44, in _clear_flags tf.app.flags.FLAGS = tf.app.flags._FlagValues() AttributeError: module 'tensorflow.python.platform.flags' has no attribute '_FlagValues'

mbehrooz avatar Feb 22 '18 01:02 mbehrooz

Incase you are still stuck, took me a bit but this finally worked:


# tf.app.flags.FLAGS = tf.app.flags._FlagValues()
attr_names = []
for i in tf.app.flags.FLAGS:
    names.append(i)
for n in attr_names:
    delattr(tf.app.flags.FLAGS, n)

Shimin-Zhang avatar Mar 07 '18 02:03 Shimin-Zhang

probably this was a mistake?

    attr_names.append(i)

ivokwee avatar Apr 18 '18 08:04 ivokwee

I am also facing this same error while using Tensorflow 1.7. @JohnSZhang 's suggestion eliminated the initial error, but now I'm encountering a DuplicateFlagError, which suggests the flags are not actually getting cleared. Any suggestions?

cameronrhamilton avatar Apr 19 '18 23:04 cameronrhamilton

tf.app.flags.FLAGS is defined in (take the codebase of tf v1.5 as example): https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/python/platform/flags.py

It's a wrapper for FlagValues which defined in: https://github.com/abseil/abseil-py/blob/master/absl/flags/_flagvalues.py

After reading the source code, i modified the function body of _clear_flags and the error gone away.
The hacking snippet looks like this:

def _clear_flags():
    """Resets Tensorflow's FLAG values"""
    #pylint: disable=W0212
    for flag_key in dir(tf.app.flags.FLAGS):
        delattr(tf.app.flags.FLAGS, flag_key)
    #tf.app.flags.FLAGS = tf.app.flags._FlagValues()
    tf.app.flags._global_parser = argparse.ArgumentParser()

@cameronrhamilton Hope can help you :)

slvher avatar Apr 24 '18 09:04 slvher

Thank you @slvher ! I am unfortunately still receiving the following error: DuplicateFlagError: The flag 'model_params' is defined twice. First from seq2seq.test.train_bin, Second from seq2seq.test.infer_bin. Description from first occurrence: YAML configuration string for the model parameters. I am investigating to determine how to fix this, but have not made much progress.

cameronrhamilton avatar Apr 25 '18 01:04 cameronrhamilton

I got a problem after i solved the #285 and the AttributeError which @mbehrooz mentioned above I used the command python -m unittest seq2seq.test.pipeline_test and i got a error below

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\tmpi7s9txub'
       
 [[Node: bleu/value = PyFunc[Tin=[DT_STRING, DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0",
_device="/job:localhost/replica:0/task:0/device:CPU:0"](bleu/sources/read, bleu/targets/read)]]

I've check the path"C:\Users\user\AppData\Local\Temp" and there is no such file... Btw im using Anaconda for python3.6 and tensorflow1.8 on window8.1

onlyjackfrost avatar Jun 09 '18 05:06 onlyjackfrost

Hi any luck resolving the above error ? I am facing the same error on tensorflow 1.8.

neerajks avatar Jun 19 '18 10:06 neerajks

@neerajks I have the same problem,

tensorflow and python version: 1.8.0 v1.8.0-0-g93bc2e2072 /usr/local/lib/python3.5/dist-packages/tensorflow/init.py

OS: ubuntu 16.04

Now ,The problem has been solved thanks @slvher

nciefeiniu avatar Jun 26 '18 05:06 nciefeiniu

I think I have sloved all these error (ImportError, _FlagValues error and _tkinter.TclError) : You could referenced this link: https://blog.csdn.net/cow66/article/details/80815394 @neerajks @nciefeiniu

awonderfullife avatar Jun 29 '18 06:06 awonderfullife

I got a problem after i solved the #285 and the AttributeError which @mbehrooz mentioned above I used the command python -m unittest seq2seq.test.pipeline_test and i got a error below

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\tmpi7s9txub'
       
 [[Node: bleu/value = PyFunc[Tin=[DT_STRING, DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0",
_device="/job:localhost/replica:0/task:0/device:CPU:0"](bleu/sources/read, bleu/targets/read)]]

I've check the path"C:\Users\user\AppData\Local\Temp" and there is no such file... Btw im using Anaconda for python3.6 and tensorflow1.8 on window8.1

I got a problem after i solved the #285 and the AttributeError which @mbehrooz mentioned above I used the command python -m unittest seq2seq.test.pipeline_test and i got a error below

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\tmpi7s9txub'
       
 [[Node: bleu/value = PyFunc[Tin=[DT_STRING, DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0",
_device="/job:localhost/replica:0/task:0/device:CPU:0"](bleu/sources/read, bleu/targets/read)]]

I've check the path"C:\Users\user\AppData\Local\Temp" and there is no such file... Btw im using Anaconda for python3.6 and tensorflow1.8 on window8.1

I got a same error. [PermissionError: [Errno 13] Permission denied: 'C:\Users\Administrator\AppData\Local\Temp\tmpzvxkn3wu']

misswang1221 avatar Dec 26 '18 08:12 misswang1221

@neerajks I have the same problem,

tensorflow and python version: 1.8.0 v1.8.0-0-g93bc2e2072 /usr/local/lib/python3.5/dist-packages/tensorflow/init.py

OS: ubuntu 16.04

Now ,The problem has been solved thanks @slvher

Any suggestions on how to fix this problem? I am working on windows 10, and I tried with the specified tf+python version above and still get the same error. I appreciate any help

Mehty avatar Feb 05 '19 18:02 Mehty

Traceback (most recent call last): File "DeepSpeech.py", line 11, in import absl.app File "/home/sehar/venv/lib/python3.6/site-packages/absl/app.py", line 40, in from absl import flags File "/home/sehar/venv/lib/python3.6/site-packages/absl/flags/init.py", line 41, in from absl.flags import _defines File "/home/sehar/venv/lib/python3.6/site-packages/absl/flags/_defines.py", line 31, in from absl.flags import _flagvalues File "/home/sehar/venv/lib/python3.6/site-packages/absl/flags/_flagvalues.py", line 27, in import logging File "/home/sehar/DeepSpeech/logging.py", line 6, in from util.flags import FLAGS File "/home/sehar/DeepSpeech/util/flags.py", line 6, in FLAGS = absl.flags.FLAGS AttributeError: module 'absl' has no attribute 'flags' kindly help me to slove this error

sehargul-123 avatar Oct 28 '19 08:10 sehargul-123

please help me in this above issue I have been using tensorflow-gpu 1.14

sehargul-123 avatar Oct 30 '19 04:10 sehargul-123