PAIR-code / lit

The Learning Interpretability Tool: Interactively analyze ML models to understand their behavior in an extensible and framework agnostic interface.
https://pair-code.github.io/lit
Apache License 2.0
3.45k stars 351 forks source link

Unable to Render LIT Widget in Jupyter Notebook on Server #1466

Open alba-perna opened 3 months ago

alba-perna commented 3 months ago

When attempting to render the LIT widget in a Jupyter Notebook on a server environment, I encounter a connection refused error. I'm using the following code to render the widget:

widget = notebook.LitWidget(models, datasets, port=8890)
widget.render(height=600)

The widget is correctly created, but I receive this error message: La página higia.hopto.org ha rechazado la conexión.

image

Also if I try to open it in another tap, the connection error persists:

widget.render(open_in_new_tab=True)

No se puede acceder a este sitio web
La página higia.hopto.org ha rechazado la conexión.
Prueba a:
Comprobar la conexión
Comprobar el proxy y el cortafuegos
ERR_CONNECTION_REFUSED

When I reproduce this code in local, it works succesfully, but on the server I have this connection problem. This issue prevents me from effectively using the LIT tool in my workflow. Any guidance or assistance on resolving this issue would be greatly appreciated.

Thank you!

RyanMullins commented 3 months ago

Hi @alba-perna, and thanks for your interest in LIT.

Can you say more about the serving environment you're using; is it a VM or hosted service, which version of Jupyter, which version of Python, which browser, etc.?

ERR_CONNECTION_REFUSED suggests to me that LIT is trying to listen on a port, but the server that the Jupyter Notebook environment isn't allowing access to whatever port LIT is trying to use. That said, it's hard to debug these sorts of things without replicating the environment, so the more details you can provide to my question above the better I'll be able to help.

alba-perna commented 3 months ago

Hi @RyanMullins

Thank you for your prompt response. Here are the details about the serving environment I'm using:

Environment Type: I am accessing Jupyter Notebook on an online server over the internet rather than running it locally on my machine. I'm using a remote server hosted on a personal server. Jupyter Version: The version of jupyter_core I'm using is 5.5.0, and the version of Jupyter Notebook is 7.0.6. Python Version: Python version 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0]. Browser: I'm using Google Chrome, version 124.0.6367.208 (Build oficial) (64 bits).

I hope this information helps you in diagnosing the issue. Please let me know if you need any further details.

RyanMullins commented 3 months ago

That sounds like a pretty standard setup. We do most of our testing against Colab, not Jupyter directly so I'll give this my best shot.

The first thing I would look at is the API token. This Stack Overflow question has a reasonable explanation of these: https://stackoverflow.com/questions/46551551/list-running-jupyter-notebooks-and-tokens

If that doesn't work, the other thing to look at is how restricted the port serving setup is on your private server. It might not be exposing the port LIT is using by default. You can configure that manually on the server and set it directly with the port= argument to the LitWidget function.