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.44k stars 350 forks source link

Errors while trying to run the examples #1501

Open aneeshmb02 opened 4 weeks ago

aneeshmb02 commented 4 weeks ago

I am trying to run the examples just to make sure it works. I am running into this error: ImportError: cannot import name 'layout' from 'lit_nlp.api'. Why is it happening and what can I do?

RyanMullins commented 4 weeks ago

How have you installed LIT in your environment, via the repo or the pip package?

aneeshmb02 commented 4 weeks ago

Using pip. And I had to install 0.4.1 because with the newer version I was getting another error (type object not subscriptable)

RyanMullins commented 4 weeks ago

For reference v0.4.1 is 2.5 years old and definitely not recommended for use by the team, so I'm very curious what's going on here and would strongly prefer to help you get on the mainline release.

Can you say more about your Python environment and setup...

Also, any error logs you can provide would be helpful.

aneeshmb02 commented 4 weeks ago

Initially I got the error TypeError: 'type' object is not subscriptable. When I looked it up in issues, I found #976 and it mentioned installing v0.4.1 so I did. It seemed to resolve that issue but cause another one. Turns out python being outdated was the issue all along. Now I am using python3.11 (Ubuntu 20.04, Intel cpu). I am not using a notebook. Simply trying to run the .py (Using python itself though, couldn't get blaze to work) But now I am getting the following error : AttributeError: module 'keras' has no attribute 'config'.

RyanMullins commented 4 weeks ago

Sounds like you're trying to use our LM Salience demo?

That Keras issues means you need to force upgrade the library to v3; tensorflow v2.15 installs Keras v2 by default but v3 is required for that demo (and iirc is the only demo we have that requires v3).

pip install -U keras keras-nlp
aneeshmb02 commented 3 weeks ago

I am still getting the same error. But maybe I do not need to run this demo at all. My objective is to use LIT to analyze a couple of llms and explain their output for particular inputs. I also need to compare variously quantized versions of those models. Can you please guide me? (I am an inexperienced intern so please excuse me)

RyanMullins commented 3 weeks ago

Would it be helpful to schedule a video call to talk through the LIT setup? You should be able to see my email on my profile page. Send me an email and we can figure out a time.