Skip to content

Commit

Permalink
Replace conda installation instructions with pip
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 544031232
  • Loading branch information
owahltinez authored and LIT team committed Jun 28, 2023
1 parent ac8dfe3 commit de23ceb
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 44 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ jobs:
# Checkout the code for this CI operation.
- uses: actions/checkout@v2

# Setup environment for LIT and test python.
- uses: conda-incubator/setup-miniconda@v2
# Setup environment for python.
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: |
conda env create -f environment.yml
conda activate lit-nlp
pip install pytest lime

# Install dependencies and test LIT.
- name: Install dependencies and test
run: |
python -m pip install -r requirements.txt
python -m pip install pytest
pytest -v
# Build front-end.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ website/www/**
**/*.pyc

**/.DS_Store
.venv/
44 changes: 19 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.9-slim
Expand All @@ -12,39 +26,19 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | \
tee /etc/apt/sources.list.d/yarn.list
RUN apt update && apt -y install yarn

# Install Anaconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/anaconda3 \
&& rm Miniconda3-latest-Linux-x86_64.sh

# Set path to conda
ENV PATH /opt/anaconda3/bin:$PATH

# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME

# Set up conda environment with production dependencies
# Set up python environment with production dependencies
# This step is slow as it installs many packages.
COPY ./environment.yml ./
RUN conda env create -f environment.yml

# Workaround for 'conda activate' depending on shell features
# that don't necessarily work in Docker.
# This simulates the effect of 'conda activate'
# See https://github.com/ContinuumIO/docker-images/issues/89
# If this breaks in a future version of conda, add
# RUN conda shell.posix activate lit-nlp
# to see what conda activate lit-nlp would do, and update the commands below
# accordingly.
ENV PATH /opt/anaconda3/envs/lit-nlp/bin:$PATH
ENV CONDA_PREFIX "/opt/anaconda3/envs/lit-nlp"
ENV CONDA_SHLVL "1"
ENV CONDA_DEFAULT_ENV "lit-nlp"
COPY ./requirements.txt ./
RUN python -m pip install -r requirements.txt

# Build front-end with yarn
COPY . ./
WORKDIR lit_nlp/client
WORKDIR /app/lit_nlp/client
ENV NODE_OPTIONS "--openssl-legacy-provider"
RUN yarn && yarn build && rm -rf node_modules/*
WORKDIR $APP_HOME

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🔥 Learning Interpretability Tool (LIT)

<!--* freshness: { owner: 'lit-dev' reviewed: '2022-11-15' } *-->
<!--* freshness: { owner: 'lit-dev' reviewed: '2023-06-27' } *-->

The Learning Interpretability Tool (🔥LIT, formerly known as the Language
Interpretability Tool) is a visual, interactive ML model-understanding tool that
Expand Down Expand Up @@ -63,10 +63,11 @@ git clone https://github.com/PAIR-code/lit.git ~/lit

# Set up Python environment
cd ~/lit
conda env create -f environment.yml
conda activate lit-nlp
conda install cudnn cupti # optional, for GPU support
conda install -c pytorch pytorch # optional, for PyTorch
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python -m pip install cudnn cupti # optional, for GPU support
python -m pip pytorch # optional, for PyTorch

# Build the frontend
(cd lit_nlp; yarn && yarn build)
Expand Down
64 changes: 64 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
absl-py==1.4.0
annoy==1.17.3
attrs==22.1.0
etils[epath]==1.3.0
flatbuffers==23.5.26
google-api-core==2.11.1
google-auth==2.20.0
google-auth-oauthlib==0.4.6
google-cloud-core==2.3.2
google-cloud-translate==3.11.1
google-pasta==0.2.0
googleapis-common-protos==1.59.1
grpcio==1.56.0
grpcio-status==1.48.2
gunicorn==20.1.0
h5py==3.9.0
idna==3.4
imageio==2.31.1
Jinja2==3.1.2
keras==2.10.0
lime==0.2.0.1
matplotlib==3.3.4
ml-collections==0.1.1
numba==0.53.1
numpy==1.23.5
pandas==2.0.2
portpicker==1.5.2
protobuf==3.19.6
requests==2.31.0
requests-oauthlib==1.3.1
rouge-score==0.1.2
sacrebleu==2.3.1
saliency==0.1.3
scikit-image==0.21.0
scikit-learn==1.0.2
scipy==1.10.1
sentencepiece==0.1.99
shap==0.37.0
six==1.16.0
stanza==1.5.0
tensorboard==2.10.1
tensorflow==2.10.0
tensorflow-datasets==4.8.0
tensorflow-estimator==2.10.0
tensorflow-hub==0.13.0
tensorflow-text==2.10.0
termcolor==2.3.0
tqdm==4.64.0
transformers==4.1.1
umap-learn==0.5.1
18 changes: 10 additions & 8 deletions website/src/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ The pip installation will install all necessary prerequisite packages for use of
```bash
# Set up Python environment
cd ~/lit
conda env create -f environment.yml
conda activate lit-nlp
conda install cudnn cupti # optional, for GPU support
conda install -c pytorch pytorch # optional, for PyTorch
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python -m pip install cudnn cupti # optional, for GPU support
python -m pip pytorch # optional, for PyTorch
```

If you want to update any of the frontend or core code, you can install a local copy from source:
Expand All @@ -49,10 +50,11 @@ git clone https://github.com/PAIR-code/lit.git ~/lit

# Set up Python environment
cd ~/lit
conda env create -f environment.yml
conda activate lit-nlp
conda install cudnn cupti # optional, for GPU support
conda install -c pytorch pytorch # optional, for PyTorch
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python -m pip install cudnn cupti # optional, for GPU support
python -m pip pytorch # optional, for PyTorch

# Build the frontend
pushd lit_nlp; yarn && yarn build; popd
Expand Down

0 comments on commit de23ceb

Please sign in to comment.