Skip to content

Commit

Permalink
Finished part of jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
surak committed Oct 13, 2023
1 parent e037f88 commit 831217b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
19 changes: 12 additions & 7 deletions 01-access-machines.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ learn = vision_learner(dls, resnet34, metrics=accuracy)
#
# Trains the model for 3 epochs with this dataset
learn.unfreeze()
learn.fit_one_cycle(3, cbs=TensorBoardCallback('runs', trace_model=True))
learn.fit_one_cycle(3, cbs=TensorBoardCallback('runs', trace_model=True, projector=True))
```

---
Expand All @@ -688,7 +688,7 @@ learn.fit_one_cycle(3, cbs=TensorBoardCallback('runs', trace_model=True))
#SBATCH --cpus-per-task=1
#SBATCH --output=output.%j
#SBATCH --error=error.%j
#SBATCH --time=00:20:00
#SBATCH --time=00:10:00
#SBATCH --partition=booster
#SBATCH --reservation=dl4neurosc # For today only

Expand Down Expand Up @@ -876,24 +876,29 @@ learn.fit_one_cycle(3, cbs=TensorBoardCallback('runs', trace_model=True))

---

## TODO ADD NEW SLIDE FOR NEW JUPYTER NOTEBOOK
## Jupyter and TensorBoard

- On Jupyter, make sure you are on the $PROJECT/YOUR USER folder
- Right click on the files list and choose `New Notebook`
- It will ask you for a kernel - Choose PyDeepLearning 2023.05
- ![](images/jupyter-8.png)
---

## Port forwarding demo:
## TensorBoard:

- On Jupyter's notebook:
- ```bash
import random
MYPORT = random.randint(10000, 15000)
%load_ext tensorboard
%tensorboard --logdir /p/project/training2336/MYUSER/runs --port 8888
notebook.display(port=8888, height=1000)
%tensorboard --logdir /p/project/training2336/strube1/runs --port $MYPORT
```

---

### Tensorboard on Juwels Booster

![](images/tensorboard-cats.png)
![](images/jupyter-9.png)


---
Expand Down
32 changes: 21 additions & 11 deletions public/01-access-machines.html
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ <h3 id="lets-train-a-classifier">Let’s train a 🐈 classifier!</h3>
<span id="cb18-16"><a href="#cb18-16" aria-hidden="true" tabindex="-1"></a><span class="co">#</span></span>
<span id="cb18-17"><a href="#cb18-17" aria-hidden="true" tabindex="-1"></a><span class="co"># Trains the model for 3 epochs with this dataset</span></span>
<span id="cb18-18"><a href="#cb18-18" aria-hidden="true" tabindex="-1"></a>learn.unfreeze()</span>
<span id="cb18-19"><a href="#cb18-19" aria-hidden="true" tabindex="-1"></a>learn.fit_one_cycle(<span class="dv">3</span>, cbs<span class="op">=</span>TensorBoardCallback(<span class="st">&#39;runs&#39;</span>, trace_model<span class="op">=</span><span class="va">True</span>))</span></code></pre></div></li>
<span id="cb18-19"><a href="#cb18-19" aria-hidden="true" tabindex="-1"></a>learn.fit_one_cycle(<span class="dv">3</span>, cbs<span class="op">=</span>TensorBoardCallback(<span class="st">&#39;runs&#39;</span>, trace_model<span class="op">=</span><span class="va">True</span>, projector<span class="op">=</span><span class="va">True</span>))</span></code></pre></div></li>
</ul>
</section>
<section class="slide level2">
Expand All @@ -947,7 +947,7 @@ <h4 id="save-this-as-fastai.sbatch">Save this as
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --cpus-per-task=1</span></span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --output=output.%j</span></span>
<span id="cb19-10"><a href="#cb19-10" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --error=error.%j</span></span>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --time=00:20:00</span></span>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --time=00:10:00</span></span>
<span id="cb19-12"><a href="#cb19-12" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --partition=booster</span></span>
<span id="cb19-13"><a href="#cb19-13" aria-hidden="true" tabindex="-1"></a><span class="co">#SBATCH --reservation=dl4neurosc # For today only</span></span>
<span id="cb19-14"><a href="#cb19-14" aria-hidden="true" tabindex="-1"></a></span>
Expand Down Expand Up @@ -1117,25 +1117,35 @@ <h3 id="tools-for-results-analysis">Tools for results analysis</h3>
class="sourceCode python"><code class="sourceCode python"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>learn.fit_one_cycle(<span class="dv">3</span>, cbs<span class="op">=</span>TensorBoardCallback(<span class="st">&#39;runs&#39;</span>, trace_model<span class="op">=</span><span class="va">True</span>))</span></code></pre></div></li>
</ul>
</section>
<section id="todo-add-new-slide-for-new-jupyter-notebook"
class="slide level2">
<h2>TODO ADD NEW SLIDE FOR NEW JUPYTER NOTEBOOK</h2>
<section id="jupyter-and-tensorboard" class="slide level2">
<h2>Jupyter and TensorBoard</h2>
<ul>
<li class="fragment">On Jupyter, make sure you are on the $PROJECT/YOUR
USER folder</li>
<li class="fragment">Right click on the files list and choose
<code>New Notebook</code></li>
<li class="fragment">It will ask you for a kernel - Choose
PyDeepLearning 2023.05</li>
<li class="fragment"><h2 id="section-2"><img
data-src="images/jupyter-8.png" /></h2></li>
</ul>
</section>
<section id="port-forwarding-demo" class="slide level2">
<h2>Port forwarding demo:</h2>
<section id="tensorboard" class="slide level2">
<h2>TensorBoard:</h2>
<ul>
<li class="fragment">On Jupyter’s notebook:</li>
<li class="fragment"><div class="sourceCode" id="cb33"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a><span class="ex">%load_ext</span> tensorboard</span>
<span id="cb33-2"><a href="#cb33-2" aria-hidden="true" tabindex="-1"></a><span class="ex">%tensorboard</span> <span class="at">--logdir</span> /p/project/training2336/MYUSER/runs <span class="at">--port</span> 8888</span>
<span id="cb33-3"><a href="#cb33-3" aria-hidden="true" tabindex="-1"></a><span class="ex">notebook.display</span><span class="er">(</span><span class="va">port</span><span class="op">=</span>8888, <span class="va">height</span><span class="op">=</span>1000<span class="kw">)</span></span></code></pre></div></li>
class="sourceCode bash"><code class="sourceCode bash"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a><span class="ex">import</span> random</span>
<span id="cb33-2"><a href="#cb33-2" aria-hidden="true" tabindex="-1"></a><span class="ex">MYPORT</span> = random.randint<span class="er">(</span><span class="ex">10000,</span> 15000<span class="kw">)</span></span>
<span id="cb33-3"><a href="#cb33-3" aria-hidden="true" tabindex="-1"></a><span class="ex">%load_ext</span> tensorboard</span>
<span id="cb33-4"><a href="#cb33-4" aria-hidden="true" tabindex="-1"></a><span class="ex">%tensorboard</span> <span class="at">--logdir</span> /p/project/training2336/strube1/runs <span class="at">--port</span> <span class="va">$MYPORT</span></span></code></pre></div></li>
</ul>
</section>
<section class="slide level2">

<h3 id="tensorboard-on-juwels-booster">Tensorboard on Juwels
Booster</h3>
<p><img data-src="images/tensorboard-cats.png" /></p>
<p><img data-src="images/jupyter-9.png" /></p>
</section>
<section id="part-1-recap" class="slide level2">
<h2>Part 1 recap</h2>
Expand Down
Binary file added public/images/jupyter-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/jupyter-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 831217b

Please sign in to comment.