From 4bf9006b7c736dc15cec61440416a3399198fec2 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Tue, 9 Jan 2024 08:52:04 -0800 Subject: [PATCH 1/2] add nltk_data and transformers --- .github/workflows/tests.yml | 1 + environment.yml | 2 ++ software/create-environment.sh | 1 + software/docker/Dockerfile | 3 ++- software/docker/requirements.txt | 3 +++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3fafcd2..13a8656 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,6 +38,7 @@ jobs: python -m ipykernel install --sys-prefix --name ppde642 --display-name "Python (ppde642)" jupyter kernelspec list ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" + ipython -c "from nltk.corpus import brown; print(brown.words())" - name: Lint run: | diff --git a/environment.yml b/environment.yml index b14c766..e0264dc 100644 --- a/environment.yml +++ b/environment.yml @@ -28,9 +28,11 @@ dependencies: # computer vision and NLP - gensim - nltk + - nltk_data - pillow - pytorch - torchvision + - transformers # others (unused) # bokeh diff --git a/software/create-environment.sh b/software/create-environment.sh index d524c82..fe2fc3c 100644 --- a/software/create-environment.sh +++ b/software/create-environment.sh @@ -13,4 +13,5 @@ python -m ipykernel install --sys-prefix --name $ENV --display-name "Python ($EN mamba clean --all --yes --quiet --no-banner mamba list --no-banner jupyter kernelspec list +ipython -c "from nltk.corpus import brown; print(brown.words())" ipython -c "import $PACKAGE; print('$PACKAGE version', $PACKAGE.__version__)" diff --git a/software/docker/Dockerfile b/software/docker/Dockerfile index 0f47e3a..f454599 100644 --- a/software/docker/Dockerfile +++ b/software/docker/Dockerfile @@ -20,7 +20,8 @@ RUN mamba update --yes -c conda-forge --strict-channel-priority --no-banner -n b mamba info --all && \ mamba list && \ jupyter kernelspec list && \ - ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" + ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" && \ + ipython -c "from nltk.corpus import brown; print(brown.words())" # copy default jupyterlab settings, then set jupyter working directory to map to mounted volume COPY --chmod=0755 overrides.json /opt/conda/share/jupyter/lab/settings/ diff --git a/software/docker/requirements.txt b/software/docker/requirements.txt index 78b7add..4492a70 100644 --- a/software/docker/requirements.txt +++ b/software/docker/requirements.txt @@ -17,8 +17,11 @@ seaborn scikit-learn scipy statsmodels +# computer vision and NLP gensim nltk +nltk_data pillow pytorch torchvision +transformers From 51ae77c8469a035ed026fbddf2abdc2a515ffad4 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Tue, 9 Jan 2024 09:02:31 -0800 Subject: [PATCH 2/2] test transformers installation --- .github/workflows/tests.yml | 3 ++- software/create-environment.sh | 1 + software/docker/Dockerfile | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13a8656..3027e1c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,8 +37,9 @@ jobs: run: | python -m ipykernel install --sys-prefix --name ppde642 --display-name "Python (ppde642)" jupyter kernelspec list - ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" ipython -c "from nltk.corpus import brown; print(brown.words())" + ipython -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))" + ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" - name: Lint run: | diff --git a/software/create-environment.sh b/software/create-environment.sh index fe2fc3c..1c86f2d 100644 --- a/software/create-environment.sh +++ b/software/create-environment.sh @@ -14,4 +14,5 @@ mamba clean --all --yes --quiet --no-banner mamba list --no-banner jupyter kernelspec list ipython -c "from nltk.corpus import brown; print(brown.words())" +ipython -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))" ipython -c "import $PACKAGE; print('$PACKAGE version', $PACKAGE.__version__)" diff --git a/software/docker/Dockerfile b/software/docker/Dockerfile index f454599..8ea7cd4 100644 --- a/software/docker/Dockerfile +++ b/software/docker/Dockerfile @@ -20,8 +20,9 @@ RUN mamba update --yes -c conda-forge --strict-channel-priority --no-banner -n b mamba info --all && \ mamba list && \ jupyter kernelspec list && \ - ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" && \ - ipython -c "from nltk.corpus import brown; print(brown.words())" + ipython -c "from nltk.corpus import brown; print(brown.words())" && \ + ipython -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))" && \ + ipython -c "import osmnx; print('OSMnx version', osmnx.__version__)" # copy default jupyterlab settings, then set jupyter working directory to map to mounted volume COPY --chmod=0755 overrides.json /opt/conda/share/jupyter/lab/settings/