Skip to content

Commit

Permalink
add runnable notebook
Browse files Browse the repository at this point in the history
Change-Id: If2f5a649f47f364400e5a4a49516afeb20a51c7f
  • Loading branch information
Qing Lan committed Sep 18, 2020
1 parent 13e1c60 commit 2c56b19
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ jobs:
- name: run Notebooks
run: |
cd djl_tmp/jupyter
rm -rf d2l-java
bash test_notebook.sh
- name: add mybinder link
run: |
cd djl_tmp
python3 tools/scripts/add_online_runner.py
- name: build docs
run: |
cd djl_tmp/docs
Expand Down
1 change: 1 addition & 0 deletions apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openjdk-11-jdk
2 changes: 2 additions & 0 deletions jupyter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This folder contains tutorials that illustrate how to accomplish basic AI tasks
- [Transfer learning example](transfer_learning_on_cifar10.ipynb)
- [Question answering example](BERTQA.ipynb)

You can run our notebook online: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/awslabs/djl/master?filepath=jupyter)

## Setup

### JDK 11 (not jre)
Expand Down
5 changes: 5 additions & 0 deletions postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
git clone https://github.com/frankfliu/IJava.git
cd IJava/
./gradlew installKernel
cd ..
rm -rf Ijava/ ~/.gradle
6 changes: 0 additions & 6 deletions tools/scripts/Dockerfile.gpu

This file was deleted.

13 changes: 13 additions & 0 deletions tools/scripts/add_online_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pathlib import Path
import glob, json

constructor = {"cell_type": "markdown", "metadata": {}}
prefix = "Run this notebook online:[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/awslabs/djl/master?filepath="

for file in Path('.').glob('**/*.ipynb'):
with open(file, mode= "r", encoding= "utf-8") as f:
data = json.loads(f.read())
with open(file, 'w') as writer:
constructor["source"] = [prefix + str(file) + ")"]
data["cells"].insert(0, constructor)
writer.write(json.dumps(data))
16 changes: 0 additions & 16 deletions tools/scripts/create_with_nvidia_docker.sh

This file was deleted.

0 comments on commit 2c56b19

Please sign in to comment.