-
Notifications
You must be signed in to change notification settings - Fork 74.7k
UnrecognizedFlagError: Unknown command line flag 'f' #17702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have the same problem. I build from source against CUDA 8.0 and cuDNN 6.0.
This example works directly on the command line python interpreter but it does not work in my jupyter notebook
|
@magicmutal
This works on Tensorflow version 1.6.0 and on the source version. For the second code snippet:
You must define the learning rate and name within tf.app.flags before you can change it within tf.app.flags.FLAGS (notice the different flags). Therefore you can make this code work by doing this:
You can un-comment FLAGS.learning_rate = 0.03 and FLAGS.name = 'Testing' if you want to change the values of learning rate or name, but you MUST declare both these variables within tf.app.flags as shown by the lines above. @dketterer the explanation for the second code snippet is similar to your problem. I have not looked at the jupyter notebook issue however, maybe make a different issue for that. Hope that helps! As a PR idea/suggestion, maybe documentation could be made on this? Not too sure. |
@PiyushDatta the first code
the second code
Actually, I got same error message. |
@magicmutal If you want to run two flag objects in the same code snippet you must change the variable names for learning rate, try the code below:
As you can see learning rate was changed to learning_rate_1 and learning_rate_2. |
I run that code but still get the same error:UnrecognizedFlagError Traceback (most recent call last) ~/projects/thanos/recently_action/env3/lib/python3.6/site-packages/tensorflow/python/platform/flags.py in getattr(self, name) ~/projects/thanos/recently_action/env3/lib/python3.6/site-packages/absl/flags/_flagvalues.py in call(self, argv, known_only) UnrecognizedFlagError: Unknown command line flag 'f' |
Is there any progress on this issue, I am having the same problem? |
@quangvu0702 @moguzozcan are you both running tensorflow 1.6.0? And which code snippet gives you the error? |
I was getting the error first at 1.5.0 then I upgraded to the latest version 1.7.0. When I call cifar10.maybe_download_and_extract() method it gives the error. I am using anaconda. `UnrecognizedFlagError Traceback (most recent call last) D:\Google Drive\Akademik\Ozyegin\CS566\Project 2\cifar10.py in maybe_download_and_extract() ~\anaconda3\lib\site-packages\tensorflow\python\platform\flags.py in getattr(self, name) ~\anaconda3\lib\site-packages\absl\flags_flagvalues.py in call(self, argv, known_only) UnrecognizedFlagError: Unknown command line flag 'f'` |
I had the same issue and I figured out now it works with version And if you need to run |
But how to run using jupter ? |
I face this problem when running code in jupyter notebook. And I don't set any flag named |
Same here. Any suggestions? Updated to the latest 1.8.0 version of TF |
Same here in Jupyter Notebook TF version is latest (1.8.0) print(FLAGS.learning_rate)
|
Same here:
gives ---------------------------------------------------------------------------
UnrecognizedFlagError Traceback (most recent call last)
<ipython-input-1-27f35e1d55fc> in <module>()
8 flags.DEFINE_string("negative_data_file", "./data/raw_comments.neg", "Data source for the negative data.")
9
---> 10 print(FLAGS.negative_data_file)
~/venvs/scipylearn/lib/python3.5/site-packages/tensorflow/python/platform/flags.py in __getattr__(self, name)
82 # a flag.
83 if not wrapped.is_parsed():
---> 84 wrapped(_sys.argv)
85 return wrapped.__getattr__(name)
86
~/venvs/scipylearn/lib/python3.5/site-packages/absl/flags/_flagvalues.py in __call__(self, argv, known_only)
628 suggestions = _helpers.get_flag_suggestions(name, list(self))
629 raise _exceptions.UnrecognizedFlagError(
--> 630 name, value, suggestions=suggestions)
631
632 self.mark_as_parsed()
UnrecognizedFlagError: Unknown command line flag 'f' |
I get this error on google colab. What is the way forward/workaround? |
I solved this issue by adding the line: |
@taixhi simple but cool solution there. thanks a lot. |
Thanks @taixhi, that solved it for me too. |
same issue, 1.8.0 and python 3.6.5. |
Thanks @taixhi . It is only valid for jupyter env. guys! |
Thanks a lot @taixhi, it works. |
This is still a bug, I'm using the native pip environment. Have I written custom code (as opposed to using a stock example script provided in TensorFlow): custom code |
Your solutions works like a charm. Thanks, @taixhi ! |
@taixhi very neat solution! Tnx. |
this is still a bug, and there isn't a known cause. please reopen |
@magicmutal Is this still an issue? Did you get a chance to try taixhi's suggestion?
|
It has been 14 days with no activity and the |
Closing due to staleness. Please use the latest version for TensorFLow and build again. Feel free to open a new issue if it still persists. Thanks! |
For those who are having issues using the flags module in jupyter notebooks, it is because sys.argv is populated from jupyter, not your notebook code. import sys
sys.argv = " --your flags --placed here".split(" ")
# Note the space at the beginning |
As @spotiris mentioned you could just remove all the cli args by import sys
sys.argv = sys.argv[:1] |
I want to train my model but I am receiving this error kindly help me + [ ! -f DeepSpeech.py ] + python -u DeepSpeech.py --train_files /home/sehar/urdu/train/urdu-train.csv --dev_files /home/sehar/urdu/urdu-train.csv --test_files /home/sehar/urdu/train/urdu-train.csv --train_batch_size 80 --dev_batch_size 80 --test_batch_size 40 --n_hidden 375 --epochs 33 --validation_step 1 --early_stop True --earlystop_nsteps 6 --estop_mean_thresh 0.1 --dropout_rate 0.22 --learning_rate 0.00095 --report_count 100 --use_seq_length False --export_dir /home/sehar/urdu-models --checkpoint_dir /home/nvidia/DeepSpeech/checkout/ --alphabet_config_path /home/sehar/urdu-models/native_client/alphabet.txt/ /home/sehar/DeepSpeech/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /home/sehar/DeepSpeech/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /home/sehar/DeepSpeech/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /home/sehar/DeepSpeech/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /home/sehar/DeepSpeech/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /home/sehar/DeepSpeech/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) /home/sehar/venv/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /home/sehar/venv/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /home/sehar/venv/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /home/sehar/venv/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /home/sehar/venv/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /home/sehar/venv/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) FATAL Flags parsing error: Unknown command line flag 'validation_step' Pass --helpshort or --helpfull to see help on flags. |
same to me |
@taixhi Could you please help me in solving for different DEFINED Parameters. As your solution just solves it for DEFINE_string by using How can I declare the flags for the below code which has integer, string and float ? flags = tf.app.flags |
I can confirm this bug is very much still there. What makes it worse is a lot of the tf-agents example scripts out there have the bug baked in... It really needs fixing.... |
bump |
It can help me. |
Here is my code: def Demo(inputs, labels):
Demo(FLAGS.inputs, FLAGS.labels) Errors are: UnrecognizedFlagError Traceback (most recent call last) 1 frames UnrecognizedFlagError: Unknown command line flag 'f' How I will get the solution? Please help. |
|
Uh oh!
There was an error while loading. Please reload this page.
System information
Problem Description
When trying to run this code
I got this error message
This is another
Did I miss anything??
I cannot figure out what the problem is.
The text was updated successfully, but these errors were encountered: