Skip to content

Commit

Permalink
colab tutorial compat
Browse files Browse the repository at this point in the history
  • Loading branch information
denizyuret committed Oct 13, 2021
1 parent 6b9e6ce commit 4720782
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 55 deletions.
6 changes: 3 additions & 3 deletions tutorial/00.Julia_is_fast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1665,15 +1665,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
},
"toc": {
"colors": {
Expand Down
6 changes: 3 additions & 3 deletions tutorial/10.Getting_to_know_Julia.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1383,15 +1383,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
9 changes: 5 additions & 4 deletions tutorial/15.quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,24 @@
"metadata": {},
"outputs": [],
"source": []
}
},
],
"metadata": {
"accelerator":"GPU",
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
12 changes: 3 additions & 9 deletions tutorial/20.mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,16 @@
"lastKernelId": null
},
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"name": "julia.ipynb",
"provenance": [],
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions tutorial/23.learning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -761,20 +761,21 @@
}
],
"metadata": {
"accelerator": "GPU",
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions tutorial/25.iterators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -453,20 +453,21 @@
}
],
"metadata": {
"accelerator":"GPU",
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/30.lin.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1470,15 +1470,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/40.mlp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -936,15 +936,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/50.cnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1553,15 +1553,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/60.rnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1141,15 +1141,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/70.imdb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/80.charlm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions tutorial/90.s2s.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,15 @@
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Julia 1.5.0",
"display_name": "Julia 1.6",
"language": "julia",
"name": "julia-1.5"
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.5.0"
"version": "1.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion tutorial/JuliaOnColab.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"nbformat":4,"nbformat_minor":0,"metadata":{"kernelspec":{"name":"julia-1.6","display_name":"Julia 1.6.3"},"accelerator":"GPU","colab":{"name":"JuliaOnColab.ipynb","provenance":[],"collapsed_sections":[]}},"cells":[{"cell_type":"markdown","metadata":{"id":"Q7S9cpFJqfXy","colab_type":"text"},"source":["## Julia on Colaboratory ##\n","\n","[Colaboratory](https://colab.research.google.com) does not provide native support for the [Julia programming language](https://julialang.org). However, since Colaboratory gives you root access to the machine that runs your notebook (the *“runtime”* in Colaboratory terminology), we can install Julia support by uploading a specially crafted Julia notebook – *this* notebook. We then install Julia and [IJulia](https://github.com/JuliaLang/IJulia.jl) ([Jupyter](https://jupyter.org)/Colaboratory notebook support) and reload the notebook so that Colaboratory detects and initiates what we installed.\n","\n","In brief:\n","\n","1. **Run the cell below**\n","2. **Reload the page**\n","3. **Edit the notebook name and start hacking Julia code below**\n","\n","**If your runtime resets**, either manually or if left idle for some time, **repeat steps 1 and 2**.\n","\n","### Acknowledgements ###\n","\n","This hack by Pontus Stenetorp is an adaptation of [James Bradbury’s original Colaboratory Julia hack](https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319/27), that broke some time in September 2019 as Colaboratory increased their level of notebook runtime isolation. There also appears to be CUDA compilation support installed by default for each notebook runtime type in October 2019, which shaves off a good 15 minutes or so from the original hack’s installation time. Adapted for Knet by Deniz Yuret."]},{"cell_type":"code","metadata":{"id":"BrHjOFFsxf7W","colab_type":"code","colab":{}},"source":["# Julia/IJulia installation cell: run once (takes 3 minutes) and reload page before running the next cell\n","%%shell\n","if ! command -v julia 2>&1 > /dev/null\n","then\n"," wget 'https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.3-linux-x86_64.tar.gz' -O /tmp/julia.tar.gz\n"," tar -x -f /tmp/julia.tar.gz -C /usr/local --strip-components 1\n"," rm /tmp/julia.tar.gz\n","fi\n","julia -e 'using Pkg; Pkg.add(\"IJulia\"); using IJulia'"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"id":"bkBZp_6YP4gf","colab_type":"code","colab":{},"executionInfo":{"status":"ok","timestamp":1597766746070,"user_tz":-180,"elapsed":15743,"user":{"displayName":"Deniz Yuret","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gj8W-IzSgNCFTMidV62_Jk1D71JEmwu-mlVQG6vzA=s64","userId":"08088404300358457303"}}},"source":["# CUDA/Knet initialization cell: run after reloading page\n","ENV[\"JULIA_CUDA_USE_BINARYBUILDER\"]=\"false\" # Use this for faster installation, otherwise CUDA libraries will be downloaded\n","Pkg.add(\"Knet\"); using Knet"],"execution_count":1,"outputs":[]},{"cell_type":"code","metadata":{"id":"pWDXteAbeUmz","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":85},"executionInfo":{"status":"ok","timestamp":1597766770605,"user_tz":-180,"elapsed":3982,"user":{"displayName":"Deniz Yuret","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gj8W-IzSgNCFTMidV62_Jk1D71JEmwu-mlVQG6vzA=s64","userId":"08088404300358457303"}},"outputId":"abcf4e28-e2c3-4a1e-83ba-384f314f698c"},"source":["# Test if Knet is working\n","a = KnetArray(randn(3,4))\n","sigm.(a)"],"execution_count":2,"outputs":[{"output_type":"execute_result","data":{"text/plain":["3×4 KnetArray{Float64,2}:\n"," 0.166717 0.736478 0.554168 0.679858\n"," 0.159598 0.189955 0.206203 0.719744\n"," 0.814341 0.480435 0.757772 0.338862"]},"metadata":{"tags":[]},"execution_count":2}]},{"cell_type":"code","metadata":{"id":"aio4RbwRRyiK","colab_type":"code","colab":{}},"source":[""],"execution_count":null,"outputs":[]}]}
{"nbformat":4,"nbformat_minor":0,"metadata":{"kernelspec":{"name":"julia-1.6","display_name":"Julia 1.6"},"accelerator":"GPU","colab":{"name":"JuliaOnColab.ipynb","provenance":[],"collapsed_sections":[]}},"cells":[{"cell_type":"markdown","metadata":{"id":"Q7S9cpFJqfXy"},"source":["## Julia on Colaboratory ##\n","\n","[Colaboratory](https://colab.research.google.com) does not provide native support for the [Julia programming language](https://julialang.org). However, since Colaboratory gives you root access to the machine that runs your notebook (the *“runtime”* in Colaboratory terminology), we can install Julia support by uploading a specially crafted Julia notebook – *this* notebook. We then install Julia and [IJulia](https://github.com/JuliaLang/IJulia.jl) ([Jupyter](https://jupyter.org)/Colaboratory notebook support) and reload the notebook so that Colaboratory detects and initiates what we installed.\n","\n","In brief:\n","\n","1. **Run the cell below**\n","2. **Reload the page**\n","3. **Edit the notebook name and start hacking Julia code below**\n","\n","**If your runtime resets**, either manually or if left idle for some time, **repeat steps 1 and 2**.\n","\n","### Acknowledgements ###\n","\n","This hack by Pontus Stenetorp is an adaptation of [James Bradbury’s original Colaboratory Julia hack](https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319/27), that broke some time in September 2019 as Colaboratory increased their level of notebook runtime isolation. There also appears to be CUDA compilation support installed by default for each notebook runtime type in October 2019, which shaves off a good 15 minutes or so from the original hack’s installation time. Adapted for Knet by Deniz Yuret."]},{"cell_type":"code","metadata":{"id":"BrHjOFFsxf7W"},"source":["# Julia/IJulia installation cell: run once (takes 30 seconds) and reload page before running the next cell\n","%%shell\n","wget 'https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.3-linux-x86_64.tar.gz' -O /tmp/julia.tar.gz\n","tar -x -f /tmp/julia.tar.gz -C /usr/local --strip-components 1\n","rm /tmp/julia.tar.gz\n","julia -e 'using Pkg; Pkg.add(\"IJulia\")'"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"id":"bkBZp_6YP4gf"},"source":["# Knet installation cell: run after reloading/renaming notebook\n","ENV[\"JULIA_CUDA_USE_BINARYBUILDER\"]=\"false\" # Use this for faster installation, otherwise CUDA libraries will be downloaded\n","using Pkg; Pkg.add(\"Knet\")"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"id":"pWDXteAbeUmz"},"source":["# All should be ready, you can start typing Julia code or cutting and pasting cells from another notebook"],"execution_count":null,"outputs":[]}]}
13 changes: 5 additions & 8 deletions tutorial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ julia> using IJulia, Knet
julia> notebook(dir=Knet.dir("tutorial"))
```

To run the notebooks in the cloud you can use [JuliaBox](), [Google
To run the notebooks in the cloud you can use [Google
Colab](https://colab.research.google.com/notebooks/welcome.ipynb), or services like
[AWS](http://aws.amazon.com). To run on JuliaBox, click the Git button in the Dashboard and
clone `https://github.com/denizyuret/Knet.jl.git`. The tutorial should be available under
`Knet/tutorial` on the Jupyter screen. To run on Colab add Julia support first using the
[JuliaOnColab.ipynb](JuliaOnColab.ipynb) notebook, then open the notebooks in
[Google
Drive](https://drive.google.com/drive/folders/19D-R31unxZV_PUYYYpCfd-gnbdUiZfNb?usp=sharing).
To run on AWS follow the instructions in the [Knet Installation
[AWS](http://aws.amazon.com). To run on Colab copy the notebooks to the "Colab Notebooks"
folder in your Google Drive, then open and follow the instructions in the
[JuliaOnColab.ipynb](JuliaOnColab.ipynb) notebook. To run on AWS follow the instructions in
the [Knet Installation
Section](http://denizyuret.github.io/Knet.jl/latest/install.html#Using-Amazon-AWS-1).

**Contents:**
Expand Down

2 comments on commit 4720782

@denizyuret
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/46714

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.4.9 -m "<description of version>" 4720782db6057e681f0719b1a9038d4b5c687ba3
git push origin v1.4.9

Please sign in to comment.