Skip to content

LECTURE: An Introduction to JAX#237

Merged
mmcky merged 80 commits intomainfrom
add-jax
Nov 15, 2022
Merged

LECTURE: An Introduction to JAX#237
mmcky merged 80 commits intomainfrom
add-jax

Conversation

@jstac
Copy link
Copy Markdown
Contributor

@jstac jstac commented Oct 3, 2022

Closes #224

This is a first pass at adding a JAX lecture. It needs a very good proofread -- I wrote it quickly! -- and it probably needs to be running on a GPU to make sense.

Looking forward to seeing this come together! All help is appreciated @mmcky @HumphreyYang @Smit-create .

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 3, 2022

  • @mmcky to setup GitHub custom runner on QuantEcon Server

@jstac
Copy link
Copy Markdown
Contributor Author

jstac commented Oct 3, 2022

@HumphreyYang , if you adjust as per #238, the merge conflict should be fixed.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 4, 2022

@HumphreyYang once main is merged into this PR -- the preview build should now get access to a GPU running on an EC2 instance.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 4, 2022

@jstac and @HumphreyYang I have disabled the build cache and enabled upload of execution reports upon failure to get a clean run and see what the build issues might be.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 4, 2022

I am getting a type error when running this local (but that is on an M1 OS X machine)

TypeErrorESC[0m: '<class 'jaxlib.xla_extension.DeviceArray'>' object does not support item assignment. JAX arrays are immutable. Instead of ``x[idx] = y``, use ``x = x.at[idx].set(y)`` or another .at[] method: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.ndarray.at.html
TypeError: '<class 'jaxlib.xla_extension.DeviceArray'>' object does not support item assignment. JAX arrays are immutable. Instead of ``x[idx] = y``, use ``x = x.at[idx].set(y)`` or another .at[] method: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.ndarray.at.html

@Smit-create
Copy link
Copy Markdown
Member

I am getting a type error when running this local (but that is on an M1 OS X machine)

I think that is intentionally kept to show the difference between numpy and JAX. I guess the error comes from line 190 which is intentional.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 4, 2022

thanks @Smit-create added a raises-exception tag.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 4, 2022

@HumphreyYang @Smit-create I am getting a missing variable error

NameErrorESC[0m: name 'β' is not defined
NameError: name 'β' is not defined

on compute_call_price_jax.

I've timed out just now -- but will try get back to this tonight.

@HumphreyYang
Copy link
Copy Markdown
Member

@mmcky, I was fixing that at the same time. It should be working after adding the condition.

mmcky and others added 2 commits October 4, 2022 21:56
Co-authored-by: Smit Lunagariya <smitlunagariya.mat18@itbhu.ac.in>
@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Oct 4, 2022

@jstac the latest error I am getting seems to be a missing component from jaxlib

cannot import name 'pocketfft' from 'jaxlib' (/__w/lecture-python-programming.myst/lecture-python-programming.myst/3/envs/quantecon/lib/python3.9/site-packages/jaxlib/__init__.py

How do you install jax and jaxlib? I have tried pip but perhaps conda is a better option?

@github-actions github-actions bot temporarily deployed to commit October 19, 2022 07:01 Inactive
@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Nov 1, 2022

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 1, 2022

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 1, 2022

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 2, 2022

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Nov 2, 2022

@jstac this PR now only contains the JAX intro lecture. Thanks for letting me use this as a test case -- greatly appreciated. All infrastructure changes are now on main

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 2, 2022

@mmcky mmcky changed the title Added jax lecture LECTURE: An Introduction to JAX Nov 2, 2022
@jstac
Copy link
Copy Markdown
Contributor Author

jstac commented Nov 14, 2022

@mmcky Please update us on the status of this PR when you have time.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Nov 14, 2022

@jstac this PR only contains content now. So if you're happy with the lecture we can publish it when you're ready.

I merged in #243 with all the testing we did on this PR.

@jstac
Copy link
Copy Markdown
Contributor Author

jstac commented Nov 15, 2022

Thanks @mmcky .

I wonder if we should be indicating to readers that what they see is output of a machine connected to a GPU, and hence what they produce at home might differ...

Anyway, please merge when ready. Let's get this live and then iterate.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Nov 15, 2022

nice thinking @jstac just building in a note on the jax lecture and updated the hardware information that is on the status.md page.

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@mmcky mmcky merged commit 66dab7e into main Nov 15, 2022
@mmcky mmcky deleted the add-jax branch November 15, 2022 08:52
@github-actions
Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

Add a lecture on JAX

4 participants