Skip to content

Commit 3d0ca51

Browse files
committed
Make tutorials available on the site
1 parent 8730a50 commit 3d0ca51

File tree

7 files changed

+77
-23
lines changed

7 files changed

+77
-23
lines changed

docs/Tutorials/ReadMe.MD

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

docs/source/conf.py

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,14 @@ def get_version_path():
8282
"_templates",
8383
os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"),
8484
]
85-
exclude_patterns = ["tutorials/index.rst", "tutorials/template_tutorial.rst"]
8685

86+
exclude_patterns = [
87+
"tutorials/index.rst",
88+
"tutorials/template_tutorial.rst",
89+
"tutorials/**/index.rst",
90+
"tutorial_sources/**/*.md", # Exclude all markdown files from tutorial_sources
91+
"tutorial_sources/**/*.MD", # Also exclude uppercase .MD files
92+
]
8793
html_static_path = ["_static"]
8894
html_css_files = ["custom.css"]
8995
html_js_files = ["custom.js"]
@@ -167,6 +173,9 @@ def get_version_path():
167173
"html_image",
168174
]
169175

176+
# Configure MyST parser to treat mermaid code blocks as mermaid directives
177+
myst_fence_as_directive = ["mermaid"]
178+
170179
autodoc_default_options = {
171180
"members": True,
172181
"undoc-members": True,
@@ -204,14 +213,15 @@ def get_version_path():
204213
sphinx_gallery_conf = {
205214
"examples_dirs": "tutorial_sources", # Path to examples directory
206215
"gallery_dirs": "tutorials", # Path to generate gallery
207-
"filename_pattern": ".*", # Include all files
216+
"filename_pattern": r".*\.py$", # Only process .py files, not .md files
208217
"download_all_examples": False,
209218
"first_notebook_cell": "%matplotlib inline",
210219
"plot_gallery": "True",
211220
"promote_jupyter_magic": True,
212221
"backreferences_dir": None,
213222
"show_signature": False,
214223
"write_computation_times": False,
224+
"ignore_pattern": r".*\.md$|.*\.MD$", # Explicitly ignore markdown files
215225
}
216226

217227

@@ -222,5 +232,40 @@ def clean_docstring_indentation(app, what, name, obj, options, lines):
222232
lines.append("")
223233

224234

235+
def copy_markdown_tutorials(app):
236+
"""Copy markdown files from tutorial_sources to tutorials directory.
237+
238+
This runs after the builder is initialized but before sphinx-gallery processes files,
239+
ensuring markdown files are available alongside generated .py tutorials.
240+
"""
241+
import shutil
242+
from pathlib import Path
243+
244+
source_dir = Path(app.srcdir) / "tutorial_sources"
245+
target_dir = Path(app.srcdir) / "tutorials"
246+
247+
# Ensure target directory exists
248+
target_dir.mkdir(parents=True, exist_ok=True)
249+
250+
# Walk through tutorial_sources and copy all .md files
251+
for md_file in source_dir.rglob("*.md"):
252+
# Skip README files
253+
if md_file.name.lower() in ["readme.md", "readme.txt"]:
254+
continue
255+
256+
# Calculate relative path from tutorial_sources
257+
rel_path = md_file.relative_to(source_dir)
258+
259+
# Create target path in tutorials directory
260+
target_path = target_dir / rel_path
261+
target_path.parent.mkdir(parents=True, exist_ok=True)
262+
263+
# Copy the file
264+
shutil.copy2(md_file, target_path)
265+
print(f"[Forge Docs] Copied {md_file.name} to {target_path.relative_to(app.srcdir)}")
266+
267+
225268
def setup(app):
226269
app.connect("autodoc-process-docstring", clean_docstring_indentation)
270+
# Use builder-inited to ensure it runs before source files are read
271+
app.connect("builder-inited", copy_markdown_tutorials)
File renamed without changes.

docs/Tutorials/2_Forge_Internals.MD renamed to docs/source/tutorial_sources/zero-to-forge/2_Forge_Internals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Part 2: Peeling Back the Abstraction - What Are Services?
22

3-
We highly recommend reading [Part 1](./1_RL_and_Forge_Fundamentals.MD) before this, it explains RL Concepts and how they land in Forge.
3+
We highly recommend reading [Part 1](./1_RL_and_Forge_Fundamentals) before this, it explains RL Concepts and how they land in Forge.
44

55
Now that you see the power of the service abstraction, let's understand what's actually happening under the hood, Grab your chai!
66

docs/Tutorials/3_Monarch_101.MD renamed to docs/source/tutorial_sources/zero-to-forge/3_Monarch_101.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Part 3: The Forge-Monarch Connection
22

3-
This is part 3 of our series, in the previous sections: we learned Part 1: [RL Concepts and how they map to Forge](./1_RL_and_Forge_Fundamentals.MD), Part 2: [Forge Internals](./2_Forge_Internals.MD).
3+
This is part 3 of our series, in the previous sections: we learned Part 1: [RL Concepts and how they map to Forge](./1_RL_and_Forge_Fundamentals), Part 2: [Forge Internals](./2_Forge_Internals).
44

55
Now let's peel back the layers. Forge services are built on top of **Monarch**, PyTorch's distributed actor framework. Understanding this connection is crucial for optimization and debugging.
66

docs/source/tutorials.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
```{toctree}
77
:maxdepth: 1
88
9+
zero-to-forge-intro
910
```

docs/source/zero-to-forge-intro.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Zero to Forge: From RL Theory to Production-Scale Implementation
2+
3+
A comprehensive guide for ML Engineers building distributed RL systems for language models.
4+
5+
Some of the examples mentioned below will be conceptual in nature for understanding. Please refer to API Docs (Coming Soon!) for more details
6+
7+
Welcome to the Tutorials section! This section is inspired by the A-Z PyTorch tutorial, shoutout to our PyTorch friends that remember!
8+
9+
## Tutorial Structure
10+
11+
This section currently is structured in 3 detailed parts:
12+
13+
1. [RL Fundamentals and Understanding Forge Terminology](tutorials/zero-to-forge/1_RL_and_Forge_Fundamentals): This gives a quick refresher of Reinforcement Learning and teaches you Forge Fundamentals
14+
2. [Forge Internals](tutorials/zero-to-forge/2_Forge_Internals): Goes a layer deeper and explains the internals of Forge
15+
3. [Monarch 101](tutorials/zero-to-forge/3_Monarch_101): It's a 101 to Monarch and how Forge Talks to Monarch
16+
17+
Each part builds upon the next and the entire section can be consumed in roughly an hour - Grab a Chai and Enjoy!
18+
19+
If you're eager, please checkout our SFT Tutorial too (Coming soon!)!
20+
21+
```{toctree}
22+
:maxdepth: 1
23+
:hidden:
24+
tutorials/zero-to-forge/1_RL_and_Forge_Fundamentals
25+
tutorials/zero-to-forge/2_Forge_Internals
26+
tutorials/zero-to-forge/3_Monarch_101
27+
```

0 commit comments

Comments
 (0)