TuringLang / docs

Documentation and tutorials for the Turing language
https://turinglang.org/docs/
MIT License
231 stars 99 forks source link

Make tutorials available on `colab` #49

Closed yebai closed 6 months ago

yebai commented 5 years ago

Colab provides a cloud-based environment for running Jupyter notebooks. It also supports GPU and TPU for free. Maybe we can make Turing tutorials available on colab to encourage users to play with it. See e.g.

Swift example in colab

How to install Julia (and packages) on colab

cpfiffer commented 5 years ago

There's two parts to this. The first is dyanmically making a notebook available on Github, which is really easy. You can just replace the tail end of the Colab URL with the notebook location in the repo:

https://colab.research.google.com/github/TuringLang/TuringTutorials/blob/master/0_Introduction.ipynb

The harder part is making the Julia runtime available easily, which would either

  1. Require a separate version of the current notebooks with a cell added on top:
!curl -sSL "https://storage.googleapis.com/julia-tpu-binaries/julia.v1.1.0-kf.tpu3.x86_64-linux-gnu.tar.gz" -o julia.tar.gz
!tar -xzf julia.tar.gz -C /usr
!rm -rf julia.tar.gz*
!julia -e 'using Pkg; pkg"add IJulia;"'
# Download and install the XLA Compiler
!if [ ! -d XLA.jl ]; then git clone https://github.com/JuliaTPU/XLA.jl; fi
!cd XLA.jl && git pull
!cd XLA.jl && julia --project=. -e 'using Pkg; pkg"instantiate"'
  1. Some other way to dynamically add the Julia binary to the Colab container.

It doesn't seem very easy right now -- if Google had native Julia support this would be trivial. We could maintain a separate folder of Colab-enabled notebooks, but they would probably be difficult to maintain when changes are made and the install period is probably not very quick.

yebai commented 6 months ago

All notebooks are now in Quarto, which are easy to run anywhere.