Closed
Description
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [X ] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
- [ X] I carefully followed the README.md.
- [ X] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
- [ X] I reviewed the Discussions, and have a new bug or useful enhancement to share.
Expected Behavior
When supplying verbose=False
to Llama
, the model should load as expected.
Current Behavior
When verbose=False
, the model fails to load:
from llama_cpp import Llama
llm = Llama(model_path='/tmp/model.gguf', verbose=False)
# ERROR:
# [/usr/local/lib/python3.10/dist-packages/llama_cpp/utils.py](https://localhost:8080/#) in __enter__(self)
# 9 self.errnull_file = open(os.devnull, "w")
# 10
#---> 11 self.old_stdout_fileno_undup = sys.stdout.fileno()
# 12 self.old_stderr_fileno_undup = sys.stderr.fileno()
# 13
#UnsupportedOperation: fileno
Environment and Context
The problem happens on Google Colab and a user reported this problem occurring on Windows 11, as well. Doesn't seem to happen on Ubuntu (or Ubuntu in WSL), though.
A Google Colab notebook reproducing the issue is available here.
Failure Information (for bugs)
# [/usr/local/lib/python3.10/dist-packages/llama_cpp/utils.py](https://localhost:8080/#) in __enter__(self)
# 9 self.errnull_file = open(os.devnull, "w")
# 10
#---> 11 self.old_stdout_fileno_undup = sys.stdout.fileno()
# 12 self.old_stderr_fileno_undup = sys.stderr.fileno()
# 13
Steps to Reproduce
A Google Colab notebook reproducing the issue is available here.