From 60225063e890cba150856899f61594617a4f2179 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Mon, 22 Sep 2025 14:45:09 -0700 Subject: [PATCH 01/15] Add doc build --- .github/workflows/docs.yml | 100 +++++++++++++++ docs/Makefile | 20 +++ docs/make.bat | 35 ++++++ docs/requirements.txt | 7 ++ docs/source/api.md | 47 +++++++ docs/source/api_actors.md | 56 +++++++++ docs/source/api_cli.md | 67 ++++++++++ docs/source/api_controller.md | 135 ++++++++++++++++++++ docs/source/api_core.md | 25 ++++ docs/source/api_data.md | 223 +++++++++++++++++++++++++++++++++ docs/source/api_envs.md | 23 ++++ docs/source/api_losses.md | 34 +++++ docs/source/api_util.md | 56 +++++++++ docs/source/concepts.md | 4 + docs/source/conf.py | 125 ++++++++++++++++++ docs/source/faq.md | 3 + docs/source/getting_started.md | 120 ++++++++++++++++++ docs/source/index.md | 36 ++++++ docs/source/tutorials.md | 4 + docs/source/usage.md | 4 + 20 files changed, 1124 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt create mode 100644 docs/source/api.md create mode 100644 docs/source/api_actors.md create mode 100644 docs/source/api_cli.md create mode 100644 docs/source/api_controller.md create mode 100644 docs/source/api_core.md create mode 100644 docs/source/api_data.md create mode 100644 docs/source/api_envs.md create mode 100644 docs/source/api_losses.md create mode 100644 docs/source/api_util.md create mode 100644 docs/source/concepts.md create mode 100644 docs/source/conf.py create mode 100644 docs/source/faq.md create mode 100644 docs/source/getting_started.md create mode 100644 docs/source/index.md create mode 100644 docs/source/tutorials.md create mode 100644 docs/source/usage.md diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..e1082017c --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,100 @@ +name: Docs + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build-docs: + name: Build Documentation + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - name: Setup conda env + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + activate-environment: test + python-version: ${{ matrix.python-version }} + - name: Update pip + run: python -m pip install --upgrade pip + - name: Install pytorch + run: python -m pip install torch==2.9.0.dev20250826 --extra-index-url https://download.pytorch.org/whl/nightly/cpu + - name: Install monarch + run: python -m pip install monarch-no-torch==0.1.0.dev20250826 --find-links assets/ci + - name: Install torchforge + run: ./scripts/install.sh + - name: Install docs dependencies + run: python -m pip install -r docs/requirements.txt + - name: Build docs + working-directory: docs + run: make -C docs html SPHINXOPTS='-W' + - name: Upload docs artifact + uses: actions/upload-artifact@v4 + with: + name: docs + path: docs/_build/html/ + +doc-preview: + runs-on: [ubuntu-latest] + needs: build-docs + if: ${{ github.event_name == 'pull_request' }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: docs + path: docs + - name: Add noindex to preview docs + run: | + echo "Adding noindex meta tag to prevent search engine indexing of preview docs" + find docs -name "*.html" -print0 | xargs -0 sed -i 's//\n /' + - name: Upload docs preview + uses: seemethere/upload-artifact-s3@v5 + if: ${{ github.event_name == 'pull_request' }} + with: + retention-days: 14 + s3-bucket: doc-previews + if-no-files-found: error + path: docs + s3-prefix: meta-pytorch/forge/${{ github.event.pull_request.number }} + + deploy-docs: + needs: build-docs + if: github.ref == 'refs/heads/main' + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: docs + path: . + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: . + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..d0c3cbf10 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 000000000..747ffb7b3 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..87c6f43da --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,7 @@ +sphinx==7.2.6 +-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2 +docutils>=0.18.1,<0.21 +sphinx-design==0.6.1 +sphinxcontrib-mermaid==1.0.0 +myst-parser #==0.18.1 # if want to contribute in markdown +sphinx-sitemap==2.7.1 diff --git a/docs/source/api.md b/docs/source/api.md new file mode 100644 index 000000000..0bb6b2fc5 --- /dev/null +++ b/docs/source/api.md @@ -0,0 +1,47 @@ +# API Reference + +This section provides comprehensive API documentation for TorchForge modules and classes. + +TorchForge is organized into several key modules, each providing specialized functionality for post-training generative AI models: + +## Module Overview + +**Core Components** +- [Interfaces & Types](api_core.md) - Core interfaces and type definitions +- [Actors](api_actors.md) - Model training and inference components +- [Controller](api_controller.md) - Distributed training orchestration and resource management + +**Data Management** +- [Data](api_data.md) - Data handling utilities, datasets, and data models + +**Training Components** +- [Losses](api_losses.md) - Loss functions for reinforcement learning and supervised fine-tuning +- [Environments](api_envs.md) - Training and inference environments + +**Tools & Utilities** +- [CLI](api_cli.md) - Command line interface +- [Utilities](api_util.md) - General utility functions and helpers + +```{toctree} +:maxdepth: 2 +:hidden: + +api_core +api_actors +api_data +api_losses +api_envs +api_controller +api_cli +api_util +``` + +## Quick Reference + +For developers looking for specific functionality: + +- **Getting started with training**: See [Actors](api_actors.md) for policy actors, trainers, and replay buffers +- **Working with data**: See [Data](api_data.md) for datasets, data models, and utilities +- **Custom loss functions**: See [Losses](api_losses.md) for GRPO and REINFORCE implementations +- **Distributed training**: See [Controller](api_controller.md) for orchestration and resource management +- **Command line tools**: See [CLI](api_cli.md) for available commands and configuration options diff --git a/docs/source/api_actors.md b/docs/source/api_actors.md new file mode 100644 index 000000000..d79a31d54 --- /dev/null +++ b/docs/source/api_actors.md @@ -0,0 +1,56 @@ +# Actors + +The actors module contains the core components for model training and inference in TorchForge. This includes policy actors, reference models, replay buffers, and trainers. + +## Overview + +```{eval-rst} +.. automodule:: forge.actors + :members: + :undoc-members: + :show-inheritance: +``` + +## Policy Actor + +The policy actor is responsible for model inference and policy interactions during training. + +```{eval-rst} +.. automodule:: forge.actors.policy + :members: + :undoc-members: + :show-inheritance: +``` + +## Reference Model + +The reference model provides baseline comparisons for reinforcement learning algorithms. + +```{eval-rst} +.. automodule:: forge.actors.reference_model + :members: + :undoc-members: + :show-inheritance: +``` + +## Replay Buffer + +The replay buffer manages storage and sampling of training experiences. + +```{eval-rst} +.. automodule:: forge.actors.replay_buffer + :members: + :undoc-members: + :show-inheritance: +``` + +## Trainer + +The trainer orchestrates the training process and implements training algorithms. + +```{eval-rst} +.. automodule:: forge.actors.trainer + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_cli.md b/docs/source/api_cli.md new file mode 100644 index 000000000..2414c30fb --- /dev/null +++ b/docs/source/api_cli.md @@ -0,0 +1,67 @@ +# Command Line Interface + +Command line tools and configuration management for TorchForge. + +## Overview + +```{eval-rst} +.. automodule:: forge.cli + :members: + :undoc-members: + :show-inheritance: +``` + +## Main CLI + +The main forge command line interface entry point. + +```{eval-rst} +.. automodule:: forge.cli.forge + :members: + :undoc-members: + :show-inheritance: +``` + +## Configuration + +Configuration management and parsing utilities. + +```{eval-rst} +.. automodule:: forge.cli.config + :members: + :undoc-members: + :show-inheritance: +``` + +## Download + +Model and data downloading utilities. + +```{eval-rst} +.. automodule:: forge.cli.download + :members: + :undoc-members: + :show-inheritance: +``` + +## Run + +Training and inference execution commands. + +```{eval-rst} +.. automodule:: forge.cli.run + :members: + :undoc-members: + :show-inheritance: +``` + +## Subcommand + +Base subcommand infrastructure and utilities. + +```{eval-rst} +.. automodule:: forge.cli.subcommand + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_controller.md b/docs/source/api_controller.md new file mode 100644 index 000000000..23e0f3165 --- /dev/null +++ b/docs/source/api_controller.md @@ -0,0 +1,135 @@ +# Controller + +Distributed training orchestration and resource management components for TorchForge. + +## Overview + +```{eval-rst} +.. automodule:: forge.controller + :members: + :undoc-members: + :show-inheritance: +``` + +## Actor Controller + +Controller for managing actor processes and coordination. + +```{eval-rst} +.. automodule:: forge.controller.actor + :members: + :undoc-members: + :show-inheritance: +``` + +## Process Mesh + +Process mesh management for distributed training coordination. + +```{eval-rst} +.. automodule:: forge.controller.proc_mesh + :members: + :undoc-members: + :show-inheritance: +``` + +## Provisioner + +Resource provisioning and management for distributed training. + +```{eval-rst} +.. automodule:: forge.controller.provisioner + :members: + :undoc-members: + :show-inheritance: +``` + +## Service Management + +Service orchestration and management components. + +### Base Service Module + +```{eval-rst} +.. automodule:: forge.controller.service + :members: + :undoc-members: + :show-inheritance: +``` + +### Service Implementation + +```{eval-rst} +.. automodule:: forge.controller.service.service + :members: + :undoc-members: + :show-inheritance: +``` + +### Service Interface + +```{eval-rst} +.. automodule:: forge.controller.service.interface + :members: + :undoc-members: + :show-inheritance: +``` + +### Metrics + +Service metrics collection and monitoring. + +```{eval-rst} +.. automodule:: forge.controller.service.metrics + :members: + :undoc-members: + :show-inheritance: +``` + +### Replica Management + +Service replica management and coordination. + +```{eval-rst} +.. automodule:: forge.controller.service.replica + :members: + :undoc-members: + :show-inheritance: +``` + +### Router + +Service routing and load balancing. + +```{eval-rst} +.. automodule:: forge.controller.service.router + :members: + :undoc-members: + :show-inheritance: +``` + +### Spawn + +Service spawning and lifecycle management. + +```{eval-rst} +.. automodule:: forge.controller.service.spawn + :members: + :undoc-members: + :show-inheritance: +``` + +## System Controllers + +Low-level system resource controllers. + +### GPU Manager + +GPU resource management and allocation. + +```{eval-rst} +.. automodule:: forge.controller.system_controllers.gpu_manager + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_core.md b/docs/source/api_core.md new file mode 100644 index 000000000..259ea8610 --- /dev/null +++ b/docs/source/api_core.md @@ -0,0 +1,25 @@ +# Core Interfaces and Types + +This section covers the fundamental interfaces and type definitions that form the foundation of TorchForge. + +## Interfaces + +The core interfaces module defines the main abstractions used throughout TorchForge. + +```{eval-rst} +.. automodule:: forge.interfaces + :members: + :undoc-members: + :show-inheritance: +``` + +## Types + +The types module contains core type definitions and data structures used across the framework. + +```{eval-rst} +.. automodule:: forge.types + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_data.md b/docs/source/api_data.md new file mode 100644 index 000000000..464f552c2 --- /dev/null +++ b/docs/source/api_data.md @@ -0,0 +1,223 @@ +# Data Management + +Comprehensive data handling utilities for training and inference, including datasets, data models, and various data processing utilities. + +## Overview + +```{eval-rst} +.. automodule:: forge.data + :members: + :undoc-members: + :show-inheritance: +``` + +## Datasets + +The datasets module provides various dataset implementations for different training scenarios. + +### Base Dataset Module + +```{eval-rst} +.. automodule:: forge.data.datasets + :members: + :undoc-members: + :show-inheritance: +``` + +### Dataset Implementation + +```{eval-rst} +.. automodule:: forge.data.datasets.dataset + :members: + :undoc-members: + :show-inheritance: +``` + +### Hugging Face Dataset + +Integration with Hugging Face datasets for seamless data loading. + +```{eval-rst} +.. automodule:: forge.data.datasets.hf_dataset + :members: + :undoc-members: + :show-inheritance: +``` + +### Packed Dataset + +Efficient packed dataset implementation for optimized training. + +```{eval-rst} +.. automodule:: forge.data.datasets.packed + :members: + :undoc-members: + :show-inheritance: +``` + +### SFT Dataset + +Supervised Fine-Tuning specific dataset implementation. + +```{eval-rst} +.. automodule:: forge.data.datasets.sft_dataset + :members: + :undoc-members: + :show-inheritance: +``` + +## Data Models + +Core data structures used throughout the training pipeline. + +### Base Data Models + +```{eval-rst} +.. automodule:: forge.data_models + :members: + :undoc-members: + :show-inheritance: +``` + +### Completion + +Data model for model completions and responses. + +```{eval-rst} +.. automodule:: forge.data_models.completion + :members: + :undoc-members: + :show-inheritance: +``` + +### Episode + +Data model for training episodes in reinforcement learning. + +```{eval-rst} +.. automodule:: forge.data_models.episode + :members: + :undoc-members: + :show-inheritance: +``` + +### Prompt + +Data model for input prompts and contexts. + +```{eval-rst} +.. automodule:: forge.data_models.prompt + :members: + :undoc-members: + :show-inheritance: +``` + +### Scored Completion + +Data model for completions with associated scores and rewards. + +```{eval-rst} +.. automodule:: forge.data_models.scored_completion + :members: + :undoc-members: + :show-inheritance: +``` + +## Data Utilities + +Various utilities for data processing, tokenization, and manipulation. + +### Collation + +Data collation utilities for batching and padding. + +```{eval-rst} +.. automodule:: forge.data.collate + :members: + :undoc-members: + :show-inheritance: +``` + +### Rewards + +Reward computation and processing utilities. + +```{eval-rst} +.. automodule:: forge.data.rewards + :members: + :undoc-members: + :show-inheritance: +``` + +### Sharding + +Data sharding utilities for distributed training. + +```{eval-rst} +.. automodule:: forge.data.sharding + :members: + :undoc-members: + :show-inheritance: +``` + +### Tokenizer + +Tokenization utilities and tokenizer management. + +```{eval-rst} +.. automodule:: forge.data.tokenizer + :members: + :undoc-members: + :show-inheritance: +``` + +### General Utilities + +General data processing and utility functions. + +```{eval-rst} +.. automodule:: forge.data.utils + :members: + :undoc-members: + :show-inheritance: +``` + +## Dataset Metrics + +Advanced metrics and monitoring for dataset performance. + +### Base Metrics + +```{eval-rst} +.. automodule:: forge.data.dataset_metrics + :members: + :undoc-members: + :show-inheritance: +``` + +### Metric Aggregation Handlers + +```{eval-rst} +.. automodule:: forge.data.dataset_metrics.metric_agg_handlers + :members: + :undoc-members: + :show-inheritance: +``` + +### Metric Aggregator + +```{eval-rst} +.. automodule:: forge.data.dataset_metrics.metric_aggregator + :members: + :undoc-members: + :show-inheritance: +``` + +### Metric Transform + +```{eval-rst} +.. automodule:: forge.data.dataset_metrics.metric_transform + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_envs.md b/docs/source/api_envs.md new file mode 100644 index 000000000..c5c8dfe83 --- /dev/null +++ b/docs/source/api_envs.md @@ -0,0 +1,23 @@ +# Environments + +Training and inference environments for TorchForge models. + +## Overview + +```{eval-rst} +.. automodule:: forge.envs + :members: + :undoc-members: + :show-inheritance: +``` + +## Chat Environment + +Chat-based environment for conversational AI training and inference. + +```{eval-rst} +.. automodule:: forge.envs.chat + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_losses.md b/docs/source/api_losses.md new file mode 100644 index 000000000..7edba3405 --- /dev/null +++ b/docs/source/api_losses.md @@ -0,0 +1,34 @@ +# Losses + +Loss functions for reinforcement learning and supervised fine-tuning in TorchForge. + +## Overview + +```{eval-rst} +.. automodule:: forge.losses + :members: + :undoc-members: + :show-inheritance: +``` + +## GRPO Loss + +Generalized Reward Policy Optimization (GRPO) loss implementation for reinforcement learning. + +```{eval-rst} +.. automodule:: forge.losses.grpo_loss + :members: + :undoc-members: + :show-inheritance: +``` + +## REINFORCE Loss + +REINFORCE algorithm loss implementation for policy gradient methods. + +```{eval-rst} +.. automodule:: forge.losses.reinforce_loss + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/api_util.md b/docs/source/api_util.md new file mode 100644 index 000000000..8d95c0ca8 --- /dev/null +++ b/docs/source/api_util.md @@ -0,0 +1,56 @@ +# Utilities + +General utility functions and helpers used throughout TorchForge. + +## Overview + +```{eval-rst} +.. automodule:: forge.util + :members: + :undoc-members: + :show-inheritance: +``` + +## Distributed Computing + +Utilities for distributed training and communication. + +```{eval-rst} +.. automodule:: forge.util.distributed + :members: + :undoc-members: + :show-inheritance: +``` + +## Logging + +Logging configuration and utilities. + +```{eval-rst} +.. automodule:: forge.util.logging + :members: + :undoc-members: + :show-inheritance: +``` + +## Metric Logging + +Specialized utilities for metrics collection and logging. + +```{eval-rst} +.. automodule:: forge.util.metric_logging + :members: + :undoc-members: + :show-inheritance: +``` + +## Operations + +General operations and computational utilities. + +```{eval-rst} +.. automodule:: forge.util.ops + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/source/concepts.md b/docs/source/concepts.md new file mode 100644 index 000000000..075d1ef7f --- /dev/null +++ b/docs/source/concepts.md @@ -0,0 +1,4 @@ +# Concepts + +This guide covers the fundamental concepts and architecture behind TorchForge, +helping you understand how the system works and how to effectively use its components. diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 000000000..638134a23 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,125 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import os +import sys + +import pytorch_sphinx_theme2 + + +project = "torchforge" +copyright = "2025, PyTorch Contributors" +author = "PyTorch Contributors" +release = "0.1" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx_design", + "sphinx_sitemap", + "sphinxcontrib.mermaid", + "pytorch_sphinx_theme2", + "myst_parser", + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", +] + +html_baseurl = "https://meta-pytorch.org/forge/" # needed for sphinx-sitemap +sitemap_locales = [None] +sitemap_excludes = [ + "search.html", + "genindex.html", +] +sitemap_url_scheme = "{link}" + +templates_path = [ + "_templates", + os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"), +] +exclude_patterns = [] + +sys.path.insert(0, os.path.abspath(".")) +sys.path.insert(0, os.path.abspath("../../src")) +html_theme = "pytorch_sphinx_theme2" +html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_static_path = ["_static"] + +html_theme_options = { + "navigation_with_keys": False, + "show_lf_header": False, + "show_lf_footer": False, + "analytics_id": "GTM-T8XT4PS", + "logo": { + "text": "Home", + }, + "icon_links": [ + { + "name": "X", + "url": "https://x.com/PyTorch", + "icon": "fa-brands fa-x-twitter", + }, + { + "name": "GitHub", + "url": "https://github.com/meta-pytorch/forge", + "icon": "fa-brands fa-github", + }, + { + "name": "Discourse", + "url": "https://discuss.pytorch.org/", + "icon": "fa-brands fa-discourse", + }, + { + "name": "PyPi", + "url": "https://pypi.org/project/forge/", + "icon": "fa-brands fa-python", + }, + ], + "use_edit_page_button": True, + "navbar_center": "navbar-nav", + "canonical_url": "https://meta-pytorch.org/forge/", + "header_links_before_dropdown": 7, +} + +theme_variables = pytorch_sphinx_theme2.get_theme_variables() + +html_context = { + "theme_variables": theme_variables, + "display_github": True, + "github_url": "https://github.com", + "github_user": "meta-pytorch", + "github_repo": "forge", + "feedback_url": "https://github.com/meta-pytorch/forge", + "github_version": "main", + "doc_path": "docs/source", +} + +myst_enable_extensions = [ + "colon_fence", + "deflist", + "html_image", +] + +autodoc_default_options = { + "members": True, + "member-order": "bysource", + "special-members": "__init__", + "undoc-members": True, + "exclude-members": "__weakref__", +} + +# Autosummary settings +autosummary_generate = True +autosummary_imported_members = True diff --git a/docs/source/faq.md b/docs/source/faq.md new file mode 100644 index 000000000..d3c027866 --- /dev/null +++ b/docs/source/faq.md @@ -0,0 +1,3 @@ +# FAQ + +This FAQ covers common questions and issues encountered when using TorchForge. diff --git a/docs/source/getting_started.md b/docs/source/getting_started.md new file mode 100644 index 000000000..2ebe4acba --- /dev/null +++ b/docs/source/getting_started.md @@ -0,0 +1,120 @@ +# Get Started + +Welcome to TorchForge! This guide will help you get up and running with TorchForge, a PyTorch-native platform specifically designed for post-training generative AI models. + +TorchForge specializes in post-training techniques for large language models, including: + +- **Supervised Fine-Tuning (SFT)**: Adapt pre-trained models to specific tasks using labeled data +- **Generalized Reward Policy Optimization (GRPO)**: Advanced reinforcement learning for model alignment +- **Multi-GPU Distributed Training**: Efficient scaling across multiple GPUs and nodes + +## Prerequisites + +Before installing TorchForge, ensure you have: + +- **Python 3.10 or 3.11** (Python 3.12+ not currently supported) +- **CUDA-compatible GPU(s)**: Minimum 3 GPUs required for GRPO training +- **conda or mamba** for environment management +- **Git and GitHub CLI (gh)**: Required for downloading compatible packages + +## Installation + +### Basic Installation + +The basic installation uses pre-packaged wheels with all necessary dependencies. + +1. **Install GitHub CLI** if not already installed: + + ```bash + gh auth login # Login with your GitHub account + ``` + +2. **Create and activate a conda environment**: + + ```bash + conda create -n forge python=3.10 + conda activate forge + ``` + +3. **Clone the repository and install**: + ```bash + git clone https://github.com/meta-pytorch/forge + cd forge + ./scripts/install.sh + ``` + + Optional: Use `--use-sudo` flag to install system packages instead of conda packages: + ```bash + ./scripts/install.sh --use-sudo + ``` + +## Verify Installation + +Test your installation by running a simple GRPO training example: + +```bash +python -m apps.grpo.main --config apps/grpo/qwen3_1_7b.yaml +``` + +If successful, you should see output confirming that GRPO training is running. + +## Quick Start Examples + +### Example 1: Supervised Fine-Tuning (SFT) + +Fine-tune a Llama3 8B model using supervised learning: + +1. **Download the model**: + ```bash + uv run forge download meta-llama/Meta-Llama-3.1-8B-Instruct \ + --output-dir /tmp/Meta-Llama-3.1-8B-Instruct \ + --ignore-patterns "original/consolidated.00.pth" + ``` + +2. **Run SFT training**: + ```bash + uv run forge run --nproc_per_node 2 apps/sft/main.py \ + --config apps/sft/llama3_8b.yaml + ``` + +This will: +- Load the Llama3 8B model +- Fine-tune on the Alpaca dataset +- Use 2 GPUs for training +- Save checkpoints every 500 steps + +### Example 2: GRPO Reinforcement Learning + +Train a model using GRPO for better alignment: + +```bash +python -m apps.grpo.main --config apps/grpo/qwen3_1_7b.yaml +``` + +This example: +- Uses the Qwen3 1.7B model +- Trains on GSM8K math problems +- Implements reward-based optimization +- Requires minimum 3 GPUs + +## What's Next? + +Now that you have TorchForge running, explore these resources to deepen your understanding: + +- **[Usage](usage.md)** - Configuration files, common use cases, and practical examples +- **[Concepts](concepts.md)** - Architecture, algorithms, and design principles +- **[API Reference](api.md)** - Detailed documentation of all modules and classes +- **[Tutorials](tutorials.md)** - Step-by-step guides for specific scenarios + +### Additional Resources + +- Check the `apps/` directory for more training examples +- Join the community on [GitHub](https://github.com/pytorch-labs/forge) and [PyTorch Forums](https://discuss.pytorch.org/) +- Report issues or contribute improvements + +## Getting Help + +- **Documentation**: Browse the full [API Reference](./api.html) +- **Examples**: Check configuration files in [apps/*/](https://github.com/meta-pytorch/forge/tree/main/apps) +- **Issues**: Report bugs on [GitHub Issues](https://github.com/meta-pytorch/forge/issues) +- **Discussions**: Join the [PyTorch Forums](https://discuss.pytorch.org/) diff --git a/docs/source/index.md b/docs/source/index.md new file mode 100644 index 000000000..c450b4ca7 --- /dev/null +++ b/docs/source/index.md @@ -0,0 +1,36 @@ +# Welcome to TorchForge documentation! + +**TorchForge** is a PyTorch-native platform specifically designed +for post-training generative AI models. + +Key Features +------------ + +* **Post-Training Focus**: Specializes in techniques + like Supervised Fine-Tuning (SFT) and Generalized Reward Policy Optimization (GRPO) +* **PyTorch Integration**: Built natively on PyTorch with + dependencies on [PyTorch nightly](https://pytorch.org/get-started/locally/), + [Monarch](https://meta-pytorch.org/monarch), [vLLM](https://docs.vllm.ai/en/latest/), + and [TorchTitan](https://github.com/pytorch/torchtitan). +* **Multi-GPU Support**: Designed for distributed training + with minimum 3 GPU requirement for GRPO training +* **Model Support**: Includes pre-configured setups for popular models + like Llama3 8B and Qwen3.1 7B + +```{toctree} +:maxdepth: 1 +:caption: Contents: + +getting_started +concepts +usage +tutorials +api +faq +``` + +## Indices and tables + +* {ref}`genindex` +* {ref}`modindex` +* {ref}`search` diff --git a/docs/source/tutorials.md b/docs/source/tutorials.md new file mode 100644 index 000000000..5cfd3dbaf --- /dev/null +++ b/docs/source/tutorials.md @@ -0,0 +1,4 @@ +# Tutorials + + This section provides step-by-step guides to help you master TorchForge's capabilities, + from basic model fine-tuning to advanced distributed training scenarios. diff --git a/docs/source/usage.md b/docs/source/usage.md new file mode 100644 index 000000000..2a61c577a --- /dev/null +++ b/docs/source/usage.md @@ -0,0 +1,4 @@ +# Usage + +This section covers practical usage patterns, +configuration management, and common scenarios for working with TorchForge effectively. From 1697b4f7d18d366390a2bba2fe579fc8f8198da3 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 09:20:28 -0700 Subject: [PATCH 02/15] Update --- docs/source/api.md | 10 --- docs/source/conf.py | 2 +- docs/source/getting_started.md | 111 --------------------------------- 3 files changed, 1 insertion(+), 122 deletions(-) diff --git a/docs/source/api.md b/docs/source/api.md index 0bb6b2fc5..7b34877af 100644 --- a/docs/source/api.md +++ b/docs/source/api.md @@ -35,13 +35,3 @@ api_controller api_cli api_util ``` - -## Quick Reference - -For developers looking for specific functionality: - -- **Getting started with training**: See [Actors](api_actors.md) for policy actors, trainers, and replay buffers -- **Working with data**: See [Data](api_data.md) for datasets, data models, and utilities -- **Custom loss functions**: See [Losses](api_losses.md) for GRPO and REINFORCE implementations -- **Distributed training**: See [Controller](api_controller.md) for orchestration and resource management -- **Command line tools**: See [CLI](api_cli.md) for available commands and configuration options diff --git a/docs/source/conf.py b/docs/source/conf.py index 638134a23..d2c9e2475 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -61,7 +61,7 @@ "navigation_with_keys": False, "show_lf_header": False, "show_lf_footer": False, - "analytics_id": "GTM-T8XT4PS", + "analytics_id": "GTM-NPLPKN5G", "logo": { "text": "Home", }, diff --git a/docs/source/getting_started.md b/docs/source/getting_started.md index 2ebe4acba..57e1b63c8 100644 --- a/docs/source/getting_started.md +++ b/docs/source/getting_started.md @@ -7,114 +7,3 @@ TorchForge specializes in post-training techniques for large language models, in - **Supervised Fine-Tuning (SFT)**: Adapt pre-trained models to specific tasks using labeled data - **Generalized Reward Policy Optimization (GRPO)**: Advanced reinforcement learning for model alignment - **Multi-GPU Distributed Training**: Efficient scaling across multiple GPUs and nodes - -## Prerequisites - -Before installing TorchForge, ensure you have: - -- **Python 3.10 or 3.11** (Python 3.12+ not currently supported) -- **CUDA-compatible GPU(s)**: Minimum 3 GPUs required for GRPO training -- **conda or mamba** for environment management -- **Git and GitHub CLI (gh)**: Required for downloading compatible packages - -## Installation - -### Basic Installation - -The basic installation uses pre-packaged wheels with all necessary dependencies. - -1. **Install GitHub CLI** if not already installed: - - ```bash - gh auth login # Login with your GitHub account - ``` - -2. **Create and activate a conda environment**: - - ```bash - conda create -n forge python=3.10 - conda activate forge - ``` - -3. **Clone the repository and install**: - ```bash - git clone https://github.com/meta-pytorch/forge - cd forge - ./scripts/install.sh - ``` - - Optional: Use `--use-sudo` flag to install system packages instead of conda packages: - ```bash - ./scripts/install.sh --use-sudo - ``` - -## Verify Installation - -Test your installation by running a simple GRPO training example: - -```bash -python -m apps.grpo.main --config apps/grpo/qwen3_1_7b.yaml -``` - -If successful, you should see output confirming that GRPO training is running. - -## Quick Start Examples - -### Example 1: Supervised Fine-Tuning (SFT) - -Fine-tune a Llama3 8B model using supervised learning: - -1. **Download the model**: - ```bash - uv run forge download meta-llama/Meta-Llama-3.1-8B-Instruct \ - --output-dir /tmp/Meta-Llama-3.1-8B-Instruct \ - --ignore-patterns "original/consolidated.00.pth" - ``` - -2. **Run SFT training**: - ```bash - uv run forge run --nproc_per_node 2 apps/sft/main.py \ - --config apps/sft/llama3_8b.yaml - ``` - -This will: -- Load the Llama3 8B model -- Fine-tune on the Alpaca dataset -- Use 2 GPUs for training -- Save checkpoints every 500 steps - -### Example 2: GRPO Reinforcement Learning - -Train a model using GRPO for better alignment: - -```bash -python -m apps.grpo.main --config apps/grpo/qwen3_1_7b.yaml -``` - -This example: -- Uses the Qwen3 1.7B model -- Trains on GSM8K math problems -- Implements reward-based optimization -- Requires minimum 3 GPUs - -## What's Next? - -Now that you have TorchForge running, explore these resources to deepen your understanding: - -- **[Usage](usage.md)** - Configuration files, common use cases, and practical examples -- **[Concepts](concepts.md)** - Architecture, algorithms, and design principles -- **[API Reference](api.md)** - Detailed documentation of all modules and classes -- **[Tutorials](tutorials.md)** - Step-by-step guides for specific scenarios - -### Additional Resources - -- Check the `apps/` directory for more training examples -- Join the community on [GitHub](https://github.com/pytorch-labs/forge) and [PyTorch Forums](https://discuss.pytorch.org/) -- Report issues or contribute improvements - -## Getting Help - -- **Documentation**: Browse the full [API Reference](./api.html) -- **Examples**: Check configuration files in [apps/*/](https://github.com/meta-pytorch/forge/tree/main/apps) -- **Issues**: Report bugs on [GitHub Issues](https://github.com/meta-pytorch/forge/issues) -- **Discussions**: Join the [PyTorch Forums](https://discuss.pytorch.org/) From 4a146deb71a84f460ec973a6817a51c52d5ac66e Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 15:46:19 -0700 Subject: [PATCH 03/15] Fixes --- .github/workflows/docs.yml | 25 +++++++++++++++++-------- docs/Makefile | 5 +++++ docs/source/conf.py | 6 ++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e1082017c..1ee0bc145 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,42 +12,51 @@ jobs: name: Build Documentation runs-on: ubuntu-latest timeout-minutes: 30 - strategy: - matrix: - python-version: ['3.10', '3.11', '3.12'] steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - submodules: recursive - name: Setup conda env uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true miniconda-version: "latest" activate-environment: test - python-version: ${{ matrix.python-version }} + python-version: '3.10' + auto-activate-base: false + - name: Verify conda environment + shell: bash -l {0} + run: | + conda info + which python + which conda - name: Update pip + shell: bash -l {0} run: python -m pip install --upgrade pip - name: Install pytorch + shell: bash -l {0} run: python -m pip install torch==2.9.0.dev20250826 --extra-index-url https://download.pytorch.org/whl/nightly/cpu - name: Install monarch + shell: bash -l {0} run: python -m pip install monarch-no-torch==0.1.0.dev20250826 --find-links assets/ci - name: Install torchforge + shell: bash -l {0} run: ./scripts/install.sh - name: Install docs dependencies + shell: bash -l {0} run: python -m pip install -r docs/requirements.txt - name: Build docs + shell: bash -l {0} working-directory: docs - run: make -C docs html SPHINXOPTS='-W' + run: make html SPHINXOPTS='-W' - name: Upload docs artifact uses: actions/upload-artifact@v4 with: name: docs path: docs/_build/html/ -doc-preview: + doc-preview: runs-on: [ubuntu-latest] needs: build-docs if: ${{ github.event_name == 'pull_request' }} @@ -73,7 +82,7 @@ doc-preview: path: docs s3-prefix: meta-pytorch/forge/${{ github.event.pull_request.number }} - deploy-docs: + deploy-docs: needs: build-docs if: github.ref == 'refs/heads/main' permissions: diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf10..90c91ee58 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,3 +1,8 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. # Minimal makefile for Sphinx documentation # diff --git a/docs/source/conf.py b/docs/source/conf.py index d2c9e2475..56107a36c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,11 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. # Configuration file for the Sphinx documentation builder. # + # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html From dbde1f21809c11b4083d2b5c995b18f251c747fb Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 15:50:17 -0700 Subject: [PATCH 04/15] Fixes --- .github/workflows/docs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1ee0bc145..9413e7071 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -42,7 +42,9 @@ jobs: run: python -m pip install monarch-no-torch==0.1.0.dev20250826 --find-links assets/ci - name: Install torchforge shell: bash -l {0} - run: ./scripts/install.sh + env: + GH_TOKEN: ${{ github.token }} + run: ./scripts/install.sh - name: Install docs dependencies shell: bash -l {0} run: python -m pip install -r docs/requirements.txt From 9d5910a640157d0fc32c38446a8e05f938be2dd1 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 16:07:00 -0700 Subject: [PATCH 05/15] Update --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9413e7071..cb9ff4ab3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -44,7 +44,7 @@ jobs: shell: bash -l {0} env: GH_TOKEN: ${{ github.token }} - run: ./scripts/install.sh + run: ./scripts/install.sh - name: Install docs dependencies shell: bash -l {0} run: python -m pip install -r docs/requirements.txt From 40284e1a01a4c83e2effe2905c57f6487e9dd1e1 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 16:13:32 -0700 Subject: [PATCH 06/15] Update --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 56107a36c..f526bb1f2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -61,7 +61,6 @@ # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -html_static_path = ["_static"] html_theme_options = { "navigation_with_keys": False, From fa9bc967eb6d898dd3216bb004384fc07de9ae56 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 17:21:37 -0700 Subject: [PATCH 07/15] Update --- docs/source/api.md | 2 - docs/source/api_actors.md | 37 ------ docs/source/api_cli.md | 67 ----------- docs/source/api_controller.md | 131 --------------------- docs/source/api_core.md | 9 -- docs/source/api_data.md | 214 +--------------------------------- docs/source/api_envs.md | 15 --- docs/source/api_losses.md | 27 +---- docs/source/api_util.md | 31 ----- docs/source/conf.py | 49 ++++++++ src/forge/types.py | 133 --------------------- 11 files changed, 55 insertions(+), 660 deletions(-) delete mode 100644 docs/source/api_cli.md delete mode 100644 src/forge/types.py diff --git a/docs/source/api.md b/docs/source/api.md index 7b34877af..5ed009c4c 100644 --- a/docs/source/api.md +++ b/docs/source/api.md @@ -19,7 +19,6 @@ TorchForge is organized into several key modules, each providing specialized fun - [Environments](api_envs.md) - Training and inference environments **Tools & Utilities** -- [CLI](api_cli.md) - Command line interface - [Utilities](api_util.md) - General utility functions and helpers ```{toctree} @@ -32,6 +31,5 @@ api_data api_losses api_envs api_controller -api_cli api_util ``` diff --git a/docs/source/api_actors.md b/docs/source/api_actors.md index d79a31d54..6ef5f1ff8 100644 --- a/docs/source/api_actors.md +++ b/docs/source/api_actors.md @@ -2,55 +2,18 @@ The actors module contains the core components for model training and inference in TorchForge. This includes policy actors, reference models, replay buffers, and trainers. -## Overview - -```{eval-rst} -.. automodule:: forge.actors - :members: - :undoc-members: - :show-inheritance: -``` - ## Policy Actor The policy actor is responsible for model inference and policy interactions during training. -```{eval-rst} -.. automodule:: forge.actors.policy - :members: - :undoc-members: - :show-inheritance: -``` - ## Reference Model The reference model provides baseline comparisons for reinforcement learning algorithms. -```{eval-rst} -.. automodule:: forge.actors.reference_model - :members: - :undoc-members: - :show-inheritance: -``` - ## Replay Buffer The replay buffer manages storage and sampling of training experiences. -```{eval-rst} -.. automodule:: forge.actors.replay_buffer - :members: - :undoc-members: - :show-inheritance: -``` - ## Trainer The trainer orchestrates the training process and implements training algorithms. - -```{eval-rst} -.. automodule:: forge.actors.trainer - :members: - :undoc-members: - :show-inheritance: -``` diff --git a/docs/source/api_cli.md b/docs/source/api_cli.md deleted file mode 100644 index 2414c30fb..000000000 --- a/docs/source/api_cli.md +++ /dev/null @@ -1,67 +0,0 @@ -# Command Line Interface - -Command line tools and configuration management for TorchForge. - -## Overview - -```{eval-rst} -.. automodule:: forge.cli - :members: - :undoc-members: - :show-inheritance: -``` - -## Main CLI - -The main forge command line interface entry point. - -```{eval-rst} -.. automodule:: forge.cli.forge - :members: - :undoc-members: - :show-inheritance: -``` - -## Configuration - -Configuration management and parsing utilities. - -```{eval-rst} -.. automodule:: forge.cli.config - :members: - :undoc-members: - :show-inheritance: -``` - -## Download - -Model and data downloading utilities. - -```{eval-rst} -.. automodule:: forge.cli.download - :members: - :undoc-members: - :show-inheritance: -``` - -## Run - -Training and inference execution commands. - -```{eval-rst} -.. automodule:: forge.cli.run - :members: - :undoc-members: - :show-inheritance: -``` - -## Subcommand - -Base subcommand infrastructure and utilities. - -```{eval-rst} -.. automodule:: forge.cli.subcommand - :members: - :undoc-members: - :show-inheritance: -``` diff --git a/docs/source/api_controller.md b/docs/source/api_controller.md index 23e0f3165..039ffc3a2 100644 --- a/docs/source/api_controller.md +++ b/docs/source/api_controller.md @@ -2,134 +2,3 @@ Distributed training orchestration and resource management components for TorchForge. -## Overview - -```{eval-rst} -.. automodule:: forge.controller - :members: - :undoc-members: - :show-inheritance: -``` - -## Actor Controller - -Controller for managing actor processes and coordination. - -```{eval-rst} -.. automodule:: forge.controller.actor - :members: - :undoc-members: - :show-inheritance: -``` - -## Process Mesh - -Process mesh management for distributed training coordination. - -```{eval-rst} -.. automodule:: forge.controller.proc_mesh - :members: - :undoc-members: - :show-inheritance: -``` - -## Provisioner - -Resource provisioning and management for distributed training. - -```{eval-rst} -.. automodule:: forge.controller.provisioner - :members: - :undoc-members: - :show-inheritance: -``` - -## Service Management - -Service orchestration and management components. - -### Base Service Module - -```{eval-rst} -.. automodule:: forge.controller.service - :members: - :undoc-members: - :show-inheritance: -``` - -### Service Implementation - -```{eval-rst} -.. automodule:: forge.controller.service.service - :members: - :undoc-members: - :show-inheritance: -``` - -### Service Interface - -```{eval-rst} -.. automodule:: forge.controller.service.interface - :members: - :undoc-members: - :show-inheritance: -``` - -### Metrics - -Service metrics collection and monitoring. - -```{eval-rst} -.. automodule:: forge.controller.service.metrics - :members: - :undoc-members: - :show-inheritance: -``` - -### Replica Management - -Service replica management and coordination. - -```{eval-rst} -.. automodule:: forge.controller.service.replica - :members: - :undoc-members: - :show-inheritance: -``` - -### Router - -Service routing and load balancing. - -```{eval-rst} -.. automodule:: forge.controller.service.router - :members: - :undoc-members: - :show-inheritance: -``` - -### Spawn - -Service spawning and lifecycle management. - -```{eval-rst} -.. automodule:: forge.controller.service.spawn - :members: - :undoc-members: - :show-inheritance: -``` - -## System Controllers - -Low-level system resource controllers. - -### GPU Manager - -GPU resource management and allocation. - -```{eval-rst} -.. automodule:: forge.controller.system_controllers.gpu_manager - :members: - :undoc-members: - :show-inheritance: -``` diff --git a/docs/source/api_core.md b/docs/source/api_core.md index 259ea8610..a6c638381 100644 --- a/docs/source/api_core.md +++ b/docs/source/api_core.md @@ -4,15 +4,6 @@ This section covers the fundamental interfaces and type definitions that form th ## Interfaces -The core interfaces module defines the main abstractions used throughout TorchForge. - -```{eval-rst} -.. automodule:: forge.interfaces - :members: - :undoc-members: - :show-inheritance: -``` - ## Types The types module contains core type definitions and data structures used across the framework. diff --git a/docs/source/api_data.md b/docs/source/api_data.md index 464f552c2..a9864b692 100644 --- a/docs/source/api_data.md +++ b/docs/source/api_data.md @@ -1,107 +1,10 @@ # Data Management -Comprehensive data handling utilities for training and inference, including datasets, data models, and various data processing utilities. +Comprehensive data handling utilities for training and +inference, including datasets, data models, and various +data processing utilities. -## Overview - -```{eval-rst} -.. automodule:: forge.data - :members: - :undoc-members: - :show-inheritance: -``` - -## Datasets - -The datasets module provides various dataset implementations for different training scenarios. - -### Base Dataset Module - -```{eval-rst} -.. automodule:: forge.data.datasets - :members: - :undoc-members: - :show-inheritance: -``` - -### Dataset Implementation - -```{eval-rst} -.. automodule:: forge.data.datasets.dataset - :members: - :undoc-members: - :show-inheritance: -``` - -### Hugging Face Dataset - -Integration with Hugging Face datasets for seamless data loading. - -```{eval-rst} -.. automodule:: forge.data.datasets.hf_dataset - :members: - :undoc-members: - :show-inheritance: -``` - -### Packed Dataset - -Efficient packed dataset implementation for optimized training. - -```{eval-rst} -.. automodule:: forge.data.datasets.packed - :members: - :undoc-members: - :show-inheritance: -``` - -### SFT Dataset - -Supervised Fine-Tuning specific dataset implementation. - -```{eval-rst} -.. automodule:: forge.data.datasets.sft_dataset - :members: - :undoc-members: - :show-inheritance: -``` - -## Data Models - -Core data structures used throughout the training pipeline. - -### Base Data Models - -```{eval-rst} -.. automodule:: forge.data_models - :members: - :undoc-members: - :show-inheritance: -``` - -### Completion - -Data model for model completions and responses. - -```{eval-rst} -.. automodule:: forge.data_models.completion - :members: - :undoc-members: - :show-inheritance: -``` - -### Episode - -Data model for training episodes in reinforcement learning. - -```{eval-rst} -.. automodule:: forge.data_models.episode - :members: - :undoc-members: - :show-inheritance: -``` - -### Prompt +## Prompt Data model for input prompts and contexts. @@ -112,112 +15,3 @@ Data model for input prompts and contexts. :show-inheritance: ``` -### Scored Completion - -Data model for completions with associated scores and rewards. - -```{eval-rst} -.. automodule:: forge.data_models.scored_completion - :members: - :undoc-members: - :show-inheritance: -``` - -## Data Utilities - -Various utilities for data processing, tokenization, and manipulation. - -### Collation - -Data collation utilities for batching and padding. - -```{eval-rst} -.. automodule:: forge.data.collate - :members: - :undoc-members: - :show-inheritance: -``` - -### Rewards - -Reward computation and processing utilities. - -```{eval-rst} -.. automodule:: forge.data.rewards - :members: - :undoc-members: - :show-inheritance: -``` - -### Sharding - -Data sharding utilities for distributed training. - -```{eval-rst} -.. automodule:: forge.data.sharding - :members: - :undoc-members: - :show-inheritance: -``` - -### Tokenizer - -Tokenization utilities and tokenizer management. - -```{eval-rst} -.. automodule:: forge.data.tokenizer - :members: - :undoc-members: - :show-inheritance: -``` - -### General Utilities - -General data processing and utility functions. - -```{eval-rst} -.. automodule:: forge.data.utils - :members: - :undoc-members: - :show-inheritance: -``` - -## Dataset Metrics - -Advanced metrics and monitoring for dataset performance. - -### Base Metrics - -```{eval-rst} -.. automodule:: forge.data.dataset_metrics - :members: - :undoc-members: - :show-inheritance: -``` - -### Metric Aggregation Handlers - -```{eval-rst} -.. automodule:: forge.data.dataset_metrics.metric_agg_handlers - :members: - :undoc-members: - :show-inheritance: -``` - -### Metric Aggregator - -```{eval-rst} -.. automodule:: forge.data.dataset_metrics.metric_aggregator - :members: - :undoc-members: - :show-inheritance: -``` - -### Metric Transform - -```{eval-rst} -.. automodule:: forge.data.dataset_metrics.metric_transform - :members: - :undoc-members: - :show-inheritance: -``` diff --git a/docs/source/api_envs.md b/docs/source/api_envs.md index c5c8dfe83..88e9d1cea 100644 --- a/docs/source/api_envs.md +++ b/docs/source/api_envs.md @@ -2,22 +2,7 @@ Training and inference environments for TorchForge models. -## Overview - -```{eval-rst} -.. automodule:: forge.envs - :members: - :undoc-members: - :show-inheritance: -``` ## Chat Environment Chat-based environment for conversational AI training and inference. - -```{eval-rst} -.. automodule:: forge.envs.chat - :members: - :undoc-members: - :show-inheritance: -``` diff --git a/docs/source/api_losses.md b/docs/source/api_losses.md index 7edba3405..097b83394 100644 --- a/docs/source/api_losses.md +++ b/docs/source/api_losses.md @@ -2,33 +2,10 @@ Loss functions for reinforcement learning and supervised fine-tuning in TorchForge. -## Overview - -```{eval-rst} -.. automodule:: forge.losses - :members: - :undoc-members: - :show-inheritance: -``` - ## GRPO Loss Generalized Reward Policy Optimization (GRPO) loss implementation for reinforcement learning. -```{eval-rst} -.. automodule:: forge.losses.grpo_loss - :members: - :undoc-members: - :show-inheritance: -``` - -## REINFORCE Loss - -REINFORCE algorithm loss implementation for policy gradient methods. +## Reinforce Loss -```{eval-rst} -.. automodule:: forge.losses.reinforce_loss - :members: - :undoc-members: - :show-inheritance: -``` +Reinforce algorithm loss implementation for policy gradient methods. diff --git a/docs/source/api_util.md b/docs/source/api_util.md index 8d95c0ca8..f15e03b76 100644 --- a/docs/source/api_util.md +++ b/docs/source/api_util.md @@ -2,15 +2,6 @@ General utility functions and helpers used throughout TorchForge. -## Overview - -```{eval-rst} -.. automodule:: forge.util - :members: - :undoc-members: - :show-inheritance: -``` - ## Distributed Computing Utilities for distributed training and communication. @@ -32,25 +23,3 @@ Logging configuration and utilities. :undoc-members: :show-inheritance: ``` - -## Metric Logging - -Specialized utilities for metrics collection and logging. - -```{eval-rst} -.. automodule:: forge.util.metric_logging - :members: - :undoc-members: - :show-inheritance: -``` - -## Operations - -General operations and computational utilities. - -```{eval-rst} -.. automodule:: forge.util.ops - :members: - :undoc-members: - :show-inheritance: -``` diff --git a/docs/source/conf.py b/docs/source/conf.py index f526bb1f2..9c28771a2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,9 +13,58 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information import os import sys +from unittest.mock import MagicMock import pytorch_sphinx_theme2 +# Add the source directory to Python path so modules can be imported +sys.path.insert(0, os.path.abspath("../../src")) + + +# Mock problematic modules that might be missing during doc build +class Mock(MagicMock): + @classmethod + def __getattr__(cls, name): + return MagicMock() + + +# Simple and reliable mocking approach +MOCK_MODULES = [ + "six", + "torch", + "torch.nn", + "torch.distributed", + "transformers", + "huggingface_hub", + "ray", + "datasets", + "accelerate", + "peft", + "monarch", + "monarch._src", + "monarch._src.actor", + "monarch._src.actor.allocator", + "monarch._src.actor.shape", + "monarch.actor", + "monarch.tools", + "monarch.tools.components", +] + +for mod_name in MOCK_MODULES: + try: + __import__(mod_name) + except ImportError: + sys.modules[mod_name] = Mock() + +# Try to import the modules to ensure they're available +try: + import forge + import forge.controller + + print("Successfully imported forge.controller") +except ImportError as e: + print(f"Warning: Could not import forge.controller: {e}") + project = "torchforge" copyright = "2025, PyTorch Contributors" diff --git a/src/forge/types.py b/src/forge/types.py deleted file mode 100644 index cc41d2185..000000000 --- a/src/forge/types.py +++ /dev/null @@ -1,133 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. - -from dataclasses import dataclass, field -from typing import Any, TypedDict, Union - - -class Message(TypedDict): - role: str - content: str | dict[str, Any] - tools: dict[str, Any] | None - - -@dataclass -class ForgeEnvInfo: - """Environment info returned with observations.""" - - episode_id: str | None = None - step_count: int = 0 - metadata: dict | None = None - - -@dataclass(kw_only=True) -class Observation: - """Base class for environment observations. - - Contract: - - Should contain all information needed by an agent to make decisions - - Should be serializable/deserializable - - Should be immutable (or treated as such) - Args: - done: Whether the episode/conversation is complete - reward: Optional reward signal (can be boolean, int, or float) - metadata: Additional data that doesn't affect agent decisions but may be useful - for transforms, logging, evaluation, etc. - """ - - done: bool = False - reward: bool | int | float | None = None - metadata: dict[str, Any] = field(default_factory=dict) - - -@dataclass(kw_only=True) -class Action: - """Base class for environment actions. - - Contract: - - Should contain all information needed to execute a step in the environment - - Should be serializable/deserializable - - Should be immutable (or treated as such) - - Args: - metadata: Additional data that may be useful for logging, debugging, or transforms - """ - - metadata: dict[str, Any] = field(default_factory=dict) - - -@dataclass -class Trajectory: - """A trajectory containing a sequence of states, actions, etc.""" - - policy_version: int - states: list[Observation] = field(default_factory=list) - actions: list[Action] = field(default_factory=list) - - def __post_init__(self): - assert self.policy_version >= 0 - - -@dataclass(kw_only=True) -class State: - """Base class for environment state. - - Contract: - - Should contain all information needed to restore the environment - - Should be serializable/deserializable - - May contain information not exposed in observations - - Args: - metadata: Additional state information that may be useful for debugging or analysis - """ - - metadata: dict[str, Any] = field(default_factory=dict) - - -@dataclass -class ProcessConfig: - """A proc_mesh config for the torchx scheduler.""" - - procs: int = 1 - with_gpus: bool = False - hosts: int | None = None - - -@dataclass -class ServiceConfig: - """ - A service config. - Args: - procs (int): Number of processes to launch for each replica of the service. - num_replicas (int): Number of replicas to launch for the service. - with_gpus (bool, optional): Whether to allocate GPUs for the service processes. - hosts (int | None, optional): Number of hosts to allocate for each replica. - health_poll_rate (float, optional): Frequency (in seconds) to poll for health status. - replica_max_concurrent_requests (int, optional): Maximum number of concurrent requests per replica. - return_first_rank_result (bool, optional): Whether to auto-unwrap ValueMesh to the first rank's result. - """ - - procs: int - num_replicas: int - with_gpus: bool = False - hosts: int | None = None - # ServiceConfig-specific fields - health_poll_rate: float = 0.2 - replica_max_concurrent_requests: int = 10 - return_first_rank_result: bool = True - - def to_process_config(self) -> ProcessConfig: - """Extract ProcessConfig from this ServiceConfig. - Maps procs to procs for ProcessConfig. - """ - return ProcessConfig( - procs=self.procs, - with_gpus=self.with_gpus, - hosts=self.hosts, - ) - - -Scalar = Union[int, float] From cdd87873f56373e9e6c2419aec113d630f06be03 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 17:37:42 -0700 Subject: [PATCH 08/15] UPdate --- src/forge/types.py | 133 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 src/forge/types.py diff --git a/src/forge/types.py b/src/forge/types.py new file mode 100644 index 000000000..9de8b8708 --- /dev/null +++ b/src/forge/types.py @@ -0,0 +1,133 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +from dataclasses import dataclass, field +from typing import Any, TypedDict, Union + + +class Message(TypedDict): + role: str + content: str | dict[str, Any] + tools: dict[str, Any] | None + + +@dataclass +class ForgeEnvInfo: + """Environment info returned with observations.""" + + episode_id: str | None = None + step_count: int = 0 + metadata: dict | None = None + + +@dataclass(kw_only=True) +class Observation: + """Base class for environment observations. + + Contract: + - Should contain all information needed by an agent to make decisions + - Should be serializable/deserializable + - Should be immutable (or treated as such) + Args: + done: Whether the episode/conversation is complete + reward: Optional reward signal (can be boolean, int, or float) + metadata: Additional data that doesn't affect agent decisions but may be useful + for transforms, logging, evaluation, etc. + """ + + done: bool = False + reward: bool | int | float | None = None + metadata: dict[str, Any] = field(default_factory=dict) + + +@dataclass(kw_only=True) +class Action: + """Base class for environment actions. + + Contract: + - Should contain all information needed to execute a step in the environment + - Should be serializable/deserializable + - Should be immutable (or treated as such) + + Args: + metadata: Additional data that may be useful for logging, debugging, or transforms + """ + + metadata: dict[str, Any] = field(default_factory=dict) + + +@dataclass +class Trajectory: + """A trajectory containing a sequence of states, actions, etc.""" + + policy_version: int + states: list[Observation] = field(default_factory=list) + actions: list[Action] = field(default_factory=list) + + def __post_init__(self): + assert self.policy_version >= 0 + + +@dataclass(kw_only=True) +class State: + """Base class for environment state. + + Contract: + - Should contain all information needed to restore the environment + - Should be serializable/deserializable + - May contain information not exposed in observations + + Args: + metadata: Additional state information that may be useful for debugging or analysis + """ + + metadata: dict[str, Any] = field(default_factory=dict) + + +@dataclass +class ProcessConfig: + """A proc_mesh config for the torchx scheduler.""" + + num_procs: int = 1 + with_gpus: bool = False + num_hosts: int | None = None + + +@dataclass +class ServiceConfig: + """ + A service config. + Args: + procs (int): Number of processes to launch for each replica of the service. + num_replicas (int): Number of replicas to launch for the service. + with_gpus (bool, optional): Whether to allocate GPUs for the service processes. + hosts (int | None, optional): Number of hosts to allocate for each replica. + health_poll_rate (float, optional): Frequency (in seconds) to poll for health status. + replica_max_concurrent_requests (int, optional): Maximum number of concurrent requests per replica. + return_first_rank_result (bool, optional): Whether to auto-unwrap ValueMesh to the first rank's result. + """ + + procs: int + num_replicas: int + with_gpus: bool = False + hosts: int | None = None + # ServiceConfig-specific fields + health_poll_rate: float = 0.2 + replica_max_concurrent_requests: int = 10 + return_first_rank_result: bool = True + + def to_process_config(self) -> ProcessConfig: + """Extract ProcessConfig from this ServiceConfig. + Maps procs to num_procs for ProcessConfig. + """ + return ProcessConfig( + num_procs=self.procs, + with_gpus=self.with_gpus, + num_hosts=self.hosts, + ) + + +Scalar = Union[int, float] From cbe7a196c7c156ebfb9227fd4d4a5fc96ff5be9d Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 17:46:50 -0700 Subject: [PATCH 09/15] Update --- .github/workflows/docs.yml | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cb9ff4ab3..761d5620a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -51,38 +51,38 @@ jobs: - name: Build docs shell: bash -l {0} working-directory: docs - run: make html SPHINXOPTS='-W' + run: make html --keep-going SPHINXOPTS='-W' - name: Upload docs artifact uses: actions/upload-artifact@v4 with: name: docs path: docs/_build/html/ - doc-preview: - runs-on: [ubuntu-latest] - needs: build-docs - if: ${{ github.event_name == 'pull_request' }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: docs - path: docs - - name: Add noindex to preview docs - run: | - echo "Adding noindex meta tag to prevent search engine indexing of preview docs" - find docs -name "*.html" -print0 | xargs -0 sed -i 's//\n /' - - name: Upload docs preview - uses: seemethere/upload-artifact-s3@v5 - if: ${{ github.event_name == 'pull_request' }} - with: - retention-days: 14 - s3-bucket: doc-previews - if-no-files-found: error - path: docs - s3-prefix: meta-pytorch/forge/${{ github.event.pull_request.number }} + # doc-preview: + # runs-on: [ubuntu-latest] + # needs: build-docs + # if: ${{ github.event_name == 'pull_request' }} + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Download artifact + # uses: actions/download-artifact@v4 + # with: + # name: docs + # path: docs + # - name: Add noindex to preview docs + # run: | + # echo "Adding noindex meta tag to prevent search engine indexing of preview docs" + # find docs -name "*.html" -print0 | xargs -0 sed -i 's//\n /' + # - name: Upload docs preview + # uses: seemethere/upload-artifact-s3@v5 + # if: ${{ github.event_name == 'pull_request' }} + # with: + # retention-days: 14 + # s3-bucket: doc-previews + # if-no-files-found: error + # path: docs + # s3-prefix: meta-pytorch/forge/${{ github.event.pull_request.number }} deploy-docs: needs: build-docs From 403654205e038b69e105ee7fd71b514ffa638e56 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 17:48:20 -0700 Subject: [PATCH 10/15] Update --- docs/source/api_core.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/docs/source/api_core.md b/docs/source/api_core.md index a6c638381..fd642e0ab 100644 --- a/docs/source/api_core.md +++ b/docs/source/api_core.md @@ -1,16 +1,5 @@ -# Core Interfaces and Types +# Core Interfaces This section covers the fundamental interfaces and type definitions that form the foundation of TorchForge. -## Interfaces -## Types - -The types module contains core type definitions and data structures used across the framework. - -```{eval-rst} -.. automodule:: forge.types - :members: - :undoc-members: - :show-inheritance: -``` From b19458e01ca37d88e67ea8305cfd0f2435135c40 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 17:52:16 -0700 Subject: [PATCH 11/15] Update --- src/forge/types.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/forge/types.py b/src/forge/types.py index 9de8b8708..cc41d2185 100644 --- a/src/forge/types.py +++ b/src/forge/types.py @@ -91,9 +91,9 @@ class State: class ProcessConfig: """A proc_mesh config for the torchx scheduler.""" - num_procs: int = 1 + procs: int = 1 with_gpus: bool = False - num_hosts: int | None = None + hosts: int | None = None @dataclass @@ -121,12 +121,12 @@ class ServiceConfig: def to_process_config(self) -> ProcessConfig: """Extract ProcessConfig from this ServiceConfig. - Maps procs to num_procs for ProcessConfig. + Maps procs to procs for ProcessConfig. """ return ProcessConfig( - num_procs=self.procs, + procs=self.procs, with_gpus=self.with_gpus, - num_hosts=self.hosts, + hosts=self.hosts, ) From eba633ca628565a5466267a6bd9850ea679dde77 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 17:59:11 -0700 Subject: [PATCH 12/15] Update --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 761d5620a..a50ed3200 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -56,7 +56,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: docs - path: docs/_build/html/ + path: docs/build/html/ # doc-preview: # runs-on: [ubuntu-latest] From 333686919d42ea3abb0069af784c6b26bd32ab28 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 18:09:25 -0700 Subject: [PATCH 13/15] Fix linter --- docs/source/conf.py | 46 --------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9c28771a2..a260302cc 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,52 +20,6 @@ # Add the source directory to Python path so modules can be imported sys.path.insert(0, os.path.abspath("../../src")) - -# Mock problematic modules that might be missing during doc build -class Mock(MagicMock): - @classmethod - def __getattr__(cls, name): - return MagicMock() - - -# Simple and reliable mocking approach -MOCK_MODULES = [ - "six", - "torch", - "torch.nn", - "torch.distributed", - "transformers", - "huggingface_hub", - "ray", - "datasets", - "accelerate", - "peft", - "monarch", - "monarch._src", - "monarch._src.actor", - "monarch._src.actor.allocator", - "monarch._src.actor.shape", - "monarch.actor", - "monarch.tools", - "monarch.tools.components", -] - -for mod_name in MOCK_MODULES: - try: - __import__(mod_name) - except ImportError: - sys.modules[mod_name] = Mock() - -# Try to import the modules to ensure they're available -try: - import forge - import forge.controller - - print("Successfully imported forge.controller") -except ImportError as e: - print(f"Warning: Could not import forge.controller: {e}") - - project = "torchforge" copyright = "2025, PyTorch Contributors" author = "PyTorch Contributors" From 28b86cd25d63af50daf5e84cc9149ded56949d07 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 18:11:44 -0700 Subject: [PATCH 14/15] Update --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index a260302cc..69b3c20b5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,7 +13,6 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information import os import sys -from unittest.mock import MagicMock import pytorch_sphinx_theme2 From adecdef297228fbba796279feebf234eb83918c7 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 23 Sep 2025 18:28:27 -0700 Subject: [PATCH 15/15] Precomit fix --- docs/source/api_controller.md | 1 - docs/source/api_core.md | 2 -- docs/source/api_data.md | 1 - 3 files changed, 4 deletions(-) diff --git a/docs/source/api_controller.md b/docs/source/api_controller.md index 039ffc3a2..e9bedda74 100644 --- a/docs/source/api_controller.md +++ b/docs/source/api_controller.md @@ -1,4 +1,3 @@ # Controller Distributed training orchestration and resource management components for TorchForge. - diff --git a/docs/source/api_core.md b/docs/source/api_core.md index fd642e0ab..75b3e9ae5 100644 --- a/docs/source/api_core.md +++ b/docs/source/api_core.md @@ -1,5 +1,3 @@ # Core Interfaces This section covers the fundamental interfaces and type definitions that form the foundation of TorchForge. - - diff --git a/docs/source/api_data.md b/docs/source/api_data.md index a9864b692..cbc1cfc53 100644 --- a/docs/source/api_data.md +++ b/docs/source/api_data.md @@ -14,4 +14,3 @@ Data model for input prompts and contexts. :undoc-members: :show-inheritance: ``` -