guidance
guidance copied to clipboard
IPython.core.display.HTML object
The bug Running from console environment results in multiple logged messages of <IPython...>. Why is the library doing IPython stuff while running gen() in a non-Jupyter run?
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
Version: 0.1.12
How do I turn off this seizure inducing flickering display cause by the IPython HTML object madness?
@michael-conrad sorry about that! You can disable this by setting echo=False
in the init of the guidance.models
object at initialization time.
I'll think about how to improve this out-of-the-box -- perhaps we can auto-detect if we're in an IPython environment and only echo in those cases?
You can also set it later, e.g. model.echo = False
Much thanks. Seems like a bad default to have true.
How about provide an option for a streaming call-back and not have it at all? This way one could set a streaming call back and then determine how to display streamed results based on the needs of the project. Would also allow streaming to the console.
How can I get my console to display the echo? Instead of showing as html objects.
When I set "echo=False", I see nothing output in console. Please kindly advise how I can print readable text on terminal, instead of <IPython.core.display.HTML object>
Have you updated? My referenced pr should have fixed it but I unfortunately never tested that particular change.
When I set "echo=False", I see nothing output in console. Please kindly advise how I can print readable text on terminal, instead of <IPython.core.display.HTML object>
I mean how to print the streaming output, which is readable instead of ipython object, on terminal as the result streams?
https://github.com/ryanpeach/guidance/blob/9546946eddd7d4960daa17086316f1a4dd061bcb/guidance/models/_model.py#L877
This should have fixed the fact it was printing a readable object instead of a string when you ran outside of jupyter. Yes echo
needs to be True
https://github.com/ryanpeach/guidance/blob/9546946eddd7d4960daa17086316f1a4dd061bcb/guidance/models/_model.py#L2
Of note, be sure that you dont have iPython
installed in your environment. Or it will import it and then it will print the html block instead.
I have installed the latest pip package of guidance installed. I also check that ipython is installed in the same environment. However, I read a lot of <IPython.core.display.HTML object> <IPython.core.display.HTML object> <IPython.core.display.HTML object> <IPython.core.display.HTML object>
Bty, I am running guidance on Ubuntu
I found the answer from https://guidance.readthedocs.io/ Thanks for your good work.
I found the answer from https://guidance.readthedocs.io/ Thanks for your good work.
What was the answer?
I'm concerned my PR didn't fix it.
Basically, echo have to be False.
Otherwise, the program generates and displays lots of <IPython.core.display.HTML object>
I need to use the streaming with instruction available at: https://guidance.readthedocs.io/en/latest/example_notebooks/tutorials/intro_to_guidance.html#Streaming
It seems to be still an issue, using guidance 0.1.15. Setting echo=False at model initialization works.