Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Almost working Google Colab example #987

Closed
g-simmons opened this issue Dec 13, 2022 · 2 comments
Closed

Almost working Google Colab example #987

g-simmons opened this issue Dec 13, 2022 · 2 comments

Comments

@g-simmons
Copy link

Hey there,

The example notebook has a comment saying that LIT does not work on Colab since the Colab python version is fixed to 3.7.

I have been trying to get LIT to work on Colab by upgrading the Python version, and I think I have some progress? I can import the lit_nlp library and create the widget, the only issue is widget.render() produces a blank output.

I'm hoping the LIT devs can provide troubleshooting input on how I might get this to work.

Current notebook version
.

@uSaiPrashanth
Copy link

What helped me fix this problem is to manually assign is_colab to true after importing notebook in colab

Here's a short example of what I ended up doing...

from lit_nlp import notebook
notebook.is_colab = True

# Rest of code cells

widget = notebook.LitWidget({'model': lit_model}, {'ds': lit_dataset})
# lit_model is a lit_nlp.api.model.Model instance
# lit_dataset is a lit_nlp.api.dataset.Dataset instance

widget.render(height = 600)

@RyanMullins
Copy link
Member

Colab is running Python v3.10 as of Apr 2023 (see googlecolab/colabtools#3572) so the Notebooks should work out of the box again. I've recently submitted a PR to remove this warning text (806e41d), but this may not update on Colab until our next release.

Closing this issue for now, but please re-open or file a new one if you run into any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants