Skip to content

Commit 564a984

Browse files
committed
Updates installation page organization and contents
* Add instructions to clone repo * Improve contributing docs * Review updating dependencies instructions * Address review comments
1 parent 6bd68a5 commit 564a984

6 files changed

Lines changed: 334 additions & 247 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ This project follows
3030
All submissions, including submissions by project members, require review. We
3131
use GitHub pull requests for this purpose. Consult
3232
[GitHub Help](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) for more
33-
information on using pull requests.
33+
information on using pull requests.

DOCS.md

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

docs/development.md

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
11
```{include} ../CONTRIBUTING.md
22
```
33

4-
## Contribute to documentation
5-
6-
The MaxText documentation website is built using [Sphinx](https://www.sphinx-doc.org) and [MyST](https://myst-parser.readthedocs.io/en/latest/). Documents are written in [MyST Markdown syntax](https://myst-parser.readthedocs.io/en/latest/syntax/typography.html#syntax-core).
7-
8-
### Building the documentation locally (optional)
9-
10-
If you are writing documentation for MaxText, you may want to preview the documentation site locally to ensure things work as expected before a deployment to Read The Docs.
11-
12-
First, make sure you install the necessary dependencies. You can do this by navigating to your local clone of the MaxText repo, following the [local installation instructions](install_maxtext.md) and running:
13-
14-
```bash
15-
uv pip install -r src/dependencies/requirements/requirements_docs.txt
16-
```
17-
18-
Once the dependencies are installed and your `maxtext_venv` virtual environment is activated, you can navigate to the `docs/` folder and run:
19-
20-
```bash
21-
cd docs
22-
sphinx-build -b html . _build/html
4+
```{toctree}
5+
---
6+
hidden:
7+
---
8+
development/update_dependencies.md
9+
development/contribute_docs.md
2310
```
24-
25-
This will generate the documentation in the `docs/_build/html` directory. These files can be opened in a web browser directly, or you can use a simple HTTP server to serve the files. For example, you can run:
26-
27-
```bash
28-
python -m http.server -d _build/html
29-
```
30-
31-
Then, open your web browser and navigate to `http://localhost:8000` to view the documentation.
32-
33-
### Adding new documentation files
34-
35-
If you are adding a new document, make sure it is included in the `toctree` directive corresponding to the section where the new document should live. For example, if adding a new tutorial, make sure it is listed in [the `docs/tutorials.md`](https://github.com/AI-Hypercomputer/maxtext/blob/7070e8eecbea8951c8e5281219ce797c8df1441f/docs/tutorials.md?plain=1#L38).
36-
37-
### Documentation deployment
38-
39-
The MaxText documentation is deployed to [https://maxtext.readthedocs.io](https://maxtext.readthedocs.io) on any successful merge to the main branch.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!--
2+
# Copyright 2023–2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
-->
16+
17+
# Contribute to documentation
18+
19+
The MaxText documentation website is built using [Sphinx](https://www.sphinx-doc.org)
20+
and [MyST](https://myst-parser.readthedocs.io/en/latest/). Documents are written
21+
in [MyST Markdown syntax](https://myst-parser.readthedocs.io/en/latest/syntax/typography.html#syntax-core).
22+
23+
## Building the documentation locally (optional)
24+
25+
If you are writing documentation for MaxText, you may want to preview the
26+
documentation site locally to ensure things work as expected before a deployment
27+
to [Read The Docs](https://readthedocs.org/).
28+
29+
First, make sure you
30+
[install MaxText from source](https://maxtext.readthedocs.io/en/latest/install_maxtext.html#from-source)
31+
and install the necessary dependencies. You can do this by navigating to your
32+
local clone of the MaxText repo and running:
33+
34+
```bash
35+
uv pip install -r src/dependencies/requirements/requirements_docs.txt
36+
```
37+
38+
Once the dependencies are installed and your `maxtext_venv` virtual environment
39+
is activated, you can navigate to the `docs/` folder and run:
40+
41+
```bash
42+
sphinx-build -b html . _build/html
43+
```
44+
45+
This will generate the documentation in the `docs/_build/html` directory. These
46+
files can be opened in a web browser directly, or you can use a simple HTTP
47+
server to serve the files. For example, you can run:
48+
49+
```bash
50+
python -m http.server -d _build/html
51+
```
52+
53+
Then, open your web browser and navigate to `http://localhost:8000` to view the
54+
documentation.
55+
56+
## Adding new documentation files
57+
58+
If you are adding a new document, make sure it is included in the `toctree`
59+
directive corresponding to the section where the new document should live. For
60+
example, if adding a new tutorial, make sure it is listed in
61+
[the `docs/tutorials.md`](https://github.com/AI-Hypercomputer/maxtext/blob/7070e8eecbea8951c8e5281219ce797c8df1441f/docs/tutorials.md?plain=1#L38)
62+
toctree.
63+
64+
## Documentation deployment
65+
66+
The latest version of the MaxText documentation, tracking the main branch of
67+
development, is automatically deployed to
68+
[https://maxtext.readthedocs.io/en/latest](https://maxtext.readthedocs.io/en/latest)
69+
on any successful merge to the main branch.
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<!--
2+
# Copyright 2023–2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
-->
16+
17+
# Update MaxText dependencies
18+
19+
## Introduction
20+
21+
This document provides a guide to updating dependencies in MaxText using the
22+
[seed-env](https://github.com/google-ml-infra/actions/tree/main/python_seed_env)
23+
tool. `seed-env` helps generate deterministic and reproducible Python
24+
environments by creating fully-pinned `requirements.txt` files from a base set
25+
of requirements.
26+
27+
Please keep dependencies updated throughout development. This will allow each
28+
commit to work properly from both a feature and dependency perspective. We will
29+
periodically upload commits to PyPI for stable releases. But it is also critical
30+
to keep dependencies in sync for users installing MaxText from source.
31+
32+
## Overview of the process
33+
34+
To update dependencies, you will follow these general steps:
35+
36+
1. **Modify base requirements**: Update the desired dependencies in
37+
`src/dependencies/requirements/base_requirements/requirements.txt` or the hardware-specific files
38+
(`src/dependencies/requirements/base_requirements/tpu-base-requirements.txt`,
39+
`src/dependencies/requirements/base_requirements/gpu-base-requirements.txt`).
40+
2. **Find the JAX build commit hash**: The dependency generation process is
41+
pinned to a specific nightly build of JAX. You need to find the commit hash
42+
for the desired JAX build.
43+
3. **Generate the requirement files**: Run the `seed-env` CLI tool to generate
44+
new, fully-pinned requirements files based on your changes.
45+
4. **Update project files**: Copy the newly generated files into the
46+
`src/dependencies/requirements/generated_requirements/` directory. If
47+
necessary, also update any dependencies that are installed directly from
48+
GitHub from the generated files to `src/dependencies/extra_deps`.
49+
5. **Verify the new dependencies**: Test the new dependencies to ensure the
50+
project installs and runs correctly.
51+
52+
The following sections provide detailed instructions for each step.
53+
54+
## Step 0: Install `seed-env`
55+
56+
First, you need to install the `seed-env` command-line tool. We recommend
57+
installing `uv` first following
58+
[uv's official installation instructions](https://docs.astral.sh/uv/getting-started/installation/)
59+
and then using it to install `seed-env`:
60+
61+
```bash
62+
uv venv --python 3.12 --seed seed_venv
63+
source seed_venv/bin/activate
64+
uv pip install seed-env
65+
```
66+
67+
Alternatively, follow the instructions in the
68+
[seed-env repository](https://github.com/google-ml-infra/actions/tree/main/python_seed_env#install-the-seed-env-tool)
69+
if you want to build `seed-env` from source.
70+
71+
## Step 1: Modify base requirements
72+
73+
Update the desired dependencies in
74+
`src/dependencies/requirements/base_requirements/requirements.txt` or the
75+
hardware-specific files
76+
(`src/dependencies/requirements/base_requirements/tpu-base-requirements.txt`,
77+
`src/dependencies/requirements/base_requirements/gpu-base-requirements.txt`).
78+
79+
## Step 2: Find the JAX build commit hash
80+
81+
The dependency generation process is pinned to a specific nightly build of JAX.
82+
You need to find the commit hash for the desired JAX build.
83+
84+
You can find the latest commit hashes in the
85+
[JAX `build/` folder](https://github.com/jax-ml/jax/commits/main/build). Choose
86+
a recent, successful build and copy its full commit hash.
87+
88+
## Step 3: Generate the requirements files
89+
90+
Next, run the `seed-env` CLI to generate the new requirements files. You will
91+
need to do this separately for the TPU and GPU environments. The generated files
92+
will be placed in a directory specified by `--output-dir`.
93+
94+
### For TPU
95+
96+
Run the following command, replacing `<jax-build-commit-hash>` with the hash you
97+
copied in the previous step.
98+
99+
```bash
100+
seed-env \
101+
--local-requirements=src/dependencies/requirements/base_requirements/tpu-base-requirements.txt \
102+
--host-name=MaxText \
103+
--seed-commit=<jax-build-commit-hash> \
104+
--python-version=3.12 \
105+
--requirements-txt=tpu-requirements.txt \
106+
--output-dir=generated_tpu_artifacts
107+
```
108+
109+
### For GPU
110+
111+
Similarly, run the command for the GPU requirements.
112+
113+
```bash
114+
seed-env \
115+
--local-requirements=src/dependencies/requirements/base_requirements/gpu-base-requirements.txt \
116+
--host-name=MaxText \
117+
--seed-commit=<jax-build-commit-hash> \
118+
--python-version=3.12 \
119+
--requirements-txt=cuda12-requirements.txt \
120+
--hardware=cuda12 \
121+
--output-dir=generated_gpu_artifacts
122+
```
123+
124+
## Step 4: Update project files
125+
126+
After generating the new requirements, you need to update the files in the
127+
MaxText repository.
128+
129+
1. **Copy the generated files:**
130+
131+
- Move `generated_tpu_artifacts/tpu-requirements.txt` to `generated_requirements/tpu-requirements.txt`.
132+
- Move `generated_gpu_artifacts/cuda12-requirements.txt` to `generated_requirements/cuda12-requirements.txt`.
133+
134+
2. **Update `src/dependencies/extra_deps` (if necessary):**
135+
Currently, MaxText uses a few dependencies, such as `mlperf-logging` and
136+
`google-jetstream`, that are installed directly from GitHub source. These are
137+
defined in `base_requirements/requirements.txt`, and the `seed-env` tool will
138+
carry them over to the generated requirements files.
139+
140+
## Step 5: Verify the new dependencies
141+
142+
Finally, test that the new dependencies install correctly and that MaxText runs
143+
as expected.
144+
145+
1. **Install MaxText:** Follow the instructions to
146+
[install MaxText from source](install-from-source).
147+
148+
2. **Run tests:** Run MaxText tests to ensure there are no regressions.

0 commit comments

Comments
 (0)