Skip to content

Commit 09d5e8b

Browse files
Revamp Sagemaker doc (#1706)
* initial PR * nit * inference-toolkit * toctree * miss * fix * clea toctree and port previous content to new section * miss * get a index.md page * a * add section in how to * change get started section * dlc faq * previous guides * structure how to * nit * first batch of notebooks * test * bedrock quickstart * Update how SageMaker docs are built - Update the GitHub Actions - Move the `docs/sagemaker` docs into the `source` directory - Add `docs/sagemaker/Makefile` and `docs/sagemaker/scripts` for automatically generating the examples and updating the `_toctree.yml` - Most of those things are ported from https://github.com/huggingface/Google-Cloud-Containers * Fix typos * nits bedrock * jumpstart guide * test * typos * dlc guide * nit * florent's review * nit --------- Co-authored-by: Alvaro Bartolome <[email protected]>
1 parent 68b89cb commit 09d5e8b

31 files changed

+2494
-375
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
name: Build sagemaker documentation
1+
name: Build SageMaker Documentation
22

33
on:
44
push:
5-
paths:
6-
- "docs/sagemaker/**"
75
branches:
86
- main
7+
- doc-builder*
8+
paths:
9+
- docs/sagemaker/**
10+
- .github/workflows/sagemaker_build_documentation.yaml
911

1012
jobs:
1113
build:
@@ -14,7 +16,9 @@ jobs:
1416
commit_sha: ${{ github.sha }}
1517
package: hub-docs
1618
package_name: sagemaker
17-
path_to_docs: hub-docs/docs/sagemaker/
19+
path_to_docs: hub-docs/docs/sagemaker/source
1820
additional_args: --not_python_module
21+
pre_command: cd hub-docs/docs/sagemaker && make docs
1922
secrets:
23+
token: ${{ secrets.HUGGINGFACE_PUSH }}
2024
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}

.github/workflows/sagemaker_build_pr_documentation.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: Build sagemaker PR Documentation
1+
name: Build SageMaker PR Documentation
22

33
on:
44
pull_request:
55
paths:
6-
- "docs/sagemaker/**"
6+
- docs/sagemaker/**
7+
- .github/workflows/sagemaker_build_pr_documentation.yaml
78

89
concurrency:
910
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -17,5 +18,6 @@ jobs:
1718
pr_number: ${{ github.event.number }}
1819
package: hub-docs
1920
package_name: sagemaker
20-
path_to_docs: hub-docs/docs/sagemaker/
21+
path_to_docs: hub-docs/docs/sagemaker/source
2122
additional_args: --not_python_module
23+
pre_command: cd hub-docs/docs/sagemaker && make docs

.github/workflows/sagemaker_delete_doc_comment.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: Delete sagemaker doc comment trigger
1+
name: Delete SageMaker PR Documentation Comment
22

33
on:
44
pull_request:
55
types: [ closed ]
66

7-
87
jobs:
98
delete:
109
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment_trigger.yml@main
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Upload sagemaker PR Documentation
1+
name: Upload SageMaker PR Documentation
22

33
on:
44
workflow_run:
5-
workflows: ["Build sagemaker PR Documentation"]
5+
workflows: ["Build SageMaker PR Documentation"]
66
types:
77
- completed
88

@@ -13,4 +13,4 @@ jobs:
1313
package_name: sagemaker
1414
secrets:
1515
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
16-
comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
16+
comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}

docs/sagemaker/Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.PHONY: docs clean help
2+
3+
docs: clean
4+
@echo "Processing README.md files from examples/gke, examples/cloud-run, and examples/vertex-ai..."
5+
@mkdir -p source/examples
6+
@echo "Converting Jupyter Notebooks to MDX..."
7+
@doc-builder notebook-to-mdx notebooks/sagemaker-sdk/
8+
@echo "Auto-generating example files for documentation..."
9+
@python scripts/auto-generate-examples.py
10+
@echo "Cleaning up generated Markdown Notebook files..."
11+
@find notebooks/sagemaker-sdk -name "sagemaker-notebook.md" -type f -delete
12+
@echo "Generating YAML tree structure and appending to _toctree.yml..."
13+
@python scripts/auto-update-toctree.py
14+
@echo "YAML tree structure appended to docs/source/_toctree.yml"
15+
@echo "Documentation setup complete."
16+
17+
clean:
18+
@echo "Cleaning up generated documentation..."
19+
@rm -rf source/examples
20+
@awk '/^# GENERATED CONTENT DO NOT EDIT!/,/^# END GENERATED CONTENT/{next} {print}' source/_toctree.yml > source/_toctree.yml.tmp && mv source/_toctree.yml.tmp source/_toctree.yml
21+
@echo "Cleaning up generated Markdown Notebook files (if any)..."
22+
@find notebooks/sagemaker-sdk -name "sagemaker-notebook.md" -type f -delete
23+
@echo "Cleanup complete."
24+
25+
serve:
26+
@echo "Serving documentation via doc-builder"
27+
doc-builder preview sagemaker source/ --not_python_module
28+
29+
help:
30+
@echo "Usage:"
31+
@echo " make docs - Auto-generate the examples for the docs"
32+
@echo " make clean - Remove the auto-generated docs"
33+
@echo " make help - Display this help message"
34+

docs/sagemaker/_toctree.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/sagemaker/index.md

Lines changed: 0 additions & 84 deletions
This file was deleted.
16.5 KB
Loading

0 commit comments

Comments
 (0)