-
Notifications
You must be signed in to change notification settings - Fork 4.7k
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Python load_model outputs blank lines to the console #909
Comments
Hi @alanorth , We will have a look. |
@Celebio it seems this line causes the blank line to print when you use
I commented it out and compiled the module locally and tested with a simple script
|
I also came across this issue. It was particularly annoying, since it would bubble an empty line (instead of the warning) to stderr every time I'd load the model. For this particular case, I had to apply the model across rows of a dask dataframe, and it can't be serialized, so I have that same function also load the model. This led to a bunch of empty lines being bubbled up to stderr. To hack around it, I just did the following: import fasttext
fasttext.FastText.eprint = print Then I was able to see the print statement. From there, silencing the statement was simple: with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
model = fasttext.load_model('lid.176.bin') Hope this helps someone else! |
Summary: This commit fixes the issue reported on #909 Reviewed By: EdouardGrave Differential Revision: D17630124 fbshipit-source-id: 9a9120b485711647266b547c6910633f83b3155f
The python bindings don't seem to have a way to run in silent or quiet mode. Simply loading a model prints a blank line to the screen.
For example, this simple script does nothing but load a model:
The script itself does not print anything to the console, but
load_model
prints a blank line:$ ./test_fasttext.py $
Python version 3.7.4 with fasttext version 0.9.1 on Linux.
The text was updated successfully, but these errors were encountered: