-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some example notebooks and a notebook related files sidebar item (#…
…108) * Copy in a couple of notebooks from cloud-ml-examples for testing * Add custom sphinx extension to show related files in notebook sidebar
- Loading branch information
1 parent
6add41e
commit ab82996
Showing
11 changed files
with
1,449 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
build | ||
*.swp | ||
|
||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pathlib | ||
|
||
|
||
def find_notebook_related_files(app, pagename, templatename, context, doctree): | ||
"""Find related files for Jupyter Notebooks in the examples section. | ||
Example notebooks should be placed in /source/examples in their own directories. | ||
This extension walks through the directory when each notebook is rendered and generates | ||
a list of all the other files in the directory. | ||
The goal is to set a list of GitHub URLs in the template context so we can render | ||
them in the sidebar. To get the GitHub url we use the ``rapids_deployment_notebooks_base_url`` config | ||
option which shows the base url for where the source files are on GitHub. | ||
""" | ||
if "examples/" in pagename and context["page_source_suffix"] == ".ipynb": | ||
source_root = pathlib.Path(__file__).parent / ".." / "source" | ||
base_url = app.config.rapids_deployment_notebooks_base_url | ||
rel_page_parent = pathlib.Path(pagename).parent | ||
path_to_page_parent = source_root / rel_page_parent | ||
|
||
related_notebook_files = [] | ||
for page in path_to_page_parent.glob("*"): | ||
if "ipynb" not in page.name: | ||
related_notebook_files.append( | ||
f"{base_url}{rel_page_parent}/{page.name}" | ||
) | ||
|
||
context["related_notebook_files"] = related_notebook_files | ||
|
||
|
||
def setup(app): | ||
app.add_config_value("rapids_deployment_notebooks_base_url", "", "html") | ||
app.connect("html-page-context", find_notebook_related_files) | ||
|
||
return { | ||
"version": "0.1", | ||
"parallel_read_safe": True, | ||
"parallel_write_safe": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% if related_notebook_files %} | ||
<div class="tocsection onthispage"> | ||
<i class="fa-regular fa-file"></i> Related files | ||
</div> | ||
<nav id="bd-toc-nav" class="page-toc"> | ||
<ul class="visible nav section-nav flex-column"> | ||
{% for file in related_notebook_files %} | ||
<li class="toc-h2 nav-item toc-entry"> | ||
<a class="reference external nav-link" href="{{ file }}"> | ||
{{ file.split("/")[-1] }} | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</nav> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
html_theme.sidebar_secondary.remove: true | ||
--- | ||
|
||
# Workflow Examples | ||
|
||
`````{grid} 1 2 2 3 | ||
:gutter: 2 2 2 2 | ||
````{grid-item-card} | ||
:link: xgboost-gpu-hpo-job-parallel-k8s/notebook | ||
:link-type: doc | ||
XGBoost HPO | ||
^^^ | ||
Scaling up hyperparameter optimization with Kubernetes and XGBoost GPU algorithm | ||
{bdg-primary}`Dask` | ||
{bdg-primary}`XGBoost` | ||
{bdg-primary}`Kubernetes` | ||
```` | ||
````{grid-item-card} | ||
:link: rapids-sagemaker-higgs/notebook | ||
:link-type: doc | ||
HPO on Sagemaker with cuML | ||
^^^ | ||
Running RAPIDS hyperparameter experiments at scale on Amazon SageMaker | ||
{bdg-primary}`cuML` | ||
{bdg-primary}`Sagemaker` | ||
{bdg-primary}`AWS` | ||
```` | ||
````` | ||
|
||
```{toctree} | ||
:maxdepth: 2 | ||
:caption: Workflow Examples | ||
:hidden: | ||
xgboost-gpu-hpo-job-parallel-k8s/notebook | ||
rapids-sagemaker-higgs/notebook | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# FROM rapidsai/rapidsai-cloud-ml:latest | ||
FROM rapidsai/rapidsai-nightly:22.12-cuda11.5-runtime-ubuntu18.04-py3.9 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends build-essential | ||
|
||
RUN source activate rapids && pip install sagemaker-training | ||
|
||
# Copies the training code inside the container | ||
COPY rapids-higgs.py /opt/ml/code/rapids-higgs.py | ||
|
||
# Defines rapids-higgs.py as script entry point | ||
ENV SAGEMAKER_PROGRAM rapids-higgs.py |
Oops, something went wrong.