Skip to content

Commit ec27970

Browse files
authored
MAINT: remove jax, pyro, torch, and gpu related software installs + GPU admonition (#453)
* MAINT: remove installs of gpu related software * Update lectures requiring GPU access * add arviz to environment * fix installs at the lecture level for non-gpu packages * add pyro-ppl package to GPU packages * switch to hide-output for collab compat testing * ensure latest collab docker runtime is used * add arviz to environment * ensure latest arviz in collab * update collab build software
1 parent 19a6874 commit ec27970

File tree

8 files changed

+50
-19
lines changed

8 files changed

+50
-19
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
shell: bash -l {0}
2323
run: |
2424
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
25+
pip install pyro-ppl
2526
pip install --upgrade "jax[cuda12-local]"
2627
pip install numpyro pyro-ppl
2728
python scripts/test-jax-install.py

.github/workflows/collab.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
execution-checks:
55
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=ubuntu24-gpu-x64/disk=large"
66
container:
7-
image: docker://us-docker.pkg.dev/colab-images/public/runtime
7+
image: docker://us-docker.pkg.dev/colab-images/public/runtime:latest
88
options: --gpus all
99
steps:
1010
- uses: actions/checkout@v4
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install Build Software
3333
shell: bash -l {0}
3434
run: |
35-
pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.2 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-reredirects sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx-proof
35+
pip install jupyter-book==1.0.3 quantecon-book-theme==0.8.2 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinxcontrib-youtube==1.3.0 sphinx-togglebutton==0.3.2 arviz sphinx-proof sphinx-exercise sphinx-reredirects
3636
# Build of HTML (Execution Testing)
3737
- name: Build HTML
3838
shell: bash -l {0}

environment.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@ dependencies:
1616
- ghp-import==1.1.0
1717
- sphinxcontrib-youtube==1.3.0 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5
1818
- sphinx-togglebutton==0.3.2
19-
# Docker Requirements
20-
- pytz
21-

lectures/_admonition/gpu.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```{admonition} GPU
2+
:class: warning
3+
4+
This lecture was built using a machine with the latest CUDA and CUDANN frameworks installed with access to a GPU.
5+
6+
To run this lecture on [Google Colab](https://colab.research.google.com/), click on the "play" icon top right, select Colab, and set the runtime environment to include a GPU.
7+
8+
To run this lecture on your own machine, you need to install the software listed following this notice.
9+
```

lectures/ar1_bayes.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,25 @@ kernelspec:
1313

1414
# Posterior Distributions for AR(1) Parameters
1515

16-
We'll begin with some Python imports.
16+
```{include} _admonition/gpu.md
17+
```
1718

19+
```{code-cell} ipython3
20+
:tags: [hide-output]
21+
22+
!pip install numpyro jax
23+
```
24+
25+
In addition to what's included in base Anaconda, we need to install the following packages
1826

1927
```{code-cell} ipython3
2028
:tags: [hide-output]
2129
22-
!pip install arviz pymc numpyro jax
30+
!pip install arviz pymc
2331
```
2432

33+
We'll begin with some Python imports.
34+
2535
```{code-cell} ipython3
2636
2737
import arviz as az

lectures/back_prop.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,21 @@ kernelspec:
1313

1414
# Introduction to Artificial Neural Networks
1515

16+
```{include} _admonition/gpu.md
17+
```
18+
19+
```{code-cell} ipython3
20+
:tags: [skip-execution]
21+
22+
!pip install --upgrade jax
23+
```
24+
25+
In addition to what's included in base Anaconda, we need to install the following packages
26+
1627
```{code-cell} ipython3
1728
:tags: [hide-output]
1829
19-
!pip install --upgrade jax jaxlib kaleido
30+
!pip install kaleido
2031
!conda install -y -c plotly plotly plotly-orca retrying
2132
```
2233

lectures/bayes_nonconj.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ kernelspec:
1313

1414
# Non-Conjugate Priors
1515

16+
```{include} _admonition/gpu.md
17+
```
18+
19+
```{code-cell} ipython3
20+
:tags: [hide-output]
21+
22+
!pip install numpyro pyro-ppl torch jax
23+
```
24+
1625
This lecture is a sequel to the {doc}`quantecon lecture <prob_meaning>`.
1726

1827
That lecture offers a Bayesian interpretation of probability in a setting in which the likelihood function and the prior distribution
@@ -43,13 +52,6 @@ The two Python modules are
4352

4453
As usual, we begin by importing some Python code.
4554

46-
```{code-cell} ipython3
47-
:tags: [hide-output]
48-
49-
# install dependencies
50-
!pip install numpyro pyro-ppl torch jax
51-
```
52-
5355
```{code-cell} ipython3
5456
import numpy as np
5557
import seaborn as sns

lectures/mix_model.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ kernelspec:
1414
(likelihood-ratio-process)=
1515
# Incorrect Models
1616

17-
In addition to what's in Anaconda, this lecture will need the following libraries:
17+
```{include} _admonition/gpu.md
18+
```
19+
1820
```{code-cell} ipython
19-
---
20-
tags: [hide-output]
21-
---
21+
:tags: [hide-output]
22+
2223
!pip install numpyro jax
2324
```
2425

0 commit comments

Comments
 (0)