Skip to content

Commit 4a49563

Browse files
bvandermoonGoogle-ML-Automation
authored andcommitted
PR #3449: Move install_maxtext_extra_deps to dependencies directory
Imported from GitHub PR #3449 # Description Move the `install_maxtext_extra_deps` deps directory to `dependencies` after `dependencies` was added to the PyPI package. # Tests This command still works/runs the expected installation: ``` uv pip install -e .[tpu] --resolution=lowest install_maxtext_tpu_github_deps # For testing locally: install_maxtext_tpu_post_train_extra_deps ``` CI also builds this command # Checklist Before submitting this PR, please make sure (put X in square brackets): - [x] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label. - [x] I have necessary comments in my code, particularly in hard-to-understand areas. - [x] I have run end-to-end tests tests and provided workload links above if applicable. - [x] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation. Copybara import of the project: -- 277b08e by Branden Vandermoon <bvandermoon@google.com>: Move install_maxtext_extra_deps to dependencies directory Merging this change closes #3449 COPYBARA_INTEGRATE_REVIEW=#3449 from AI-Hypercomputer:bvandermoon-github-deps 277b08e PiperOrigin-RevId: 886463160
1 parent e1a2ba7 commit 4a49563

16 files changed

Lines changed: 32 additions & 32 deletions

.github/workflows/build_and_test_maxtext.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ jobs:
262262
tf_force_gpu_allow_growth: false
263263
container_resource_option: "--privileged"
264264
is_scheduled_run: ${{ github.event_name == 'schedule' }}
265-
extra_pip_deps_file: 'src/install_maxtext_extra_deps/extra_post_train_base_deps_from_github.txt'
265+
extra_pip_deps_file: 'src/dependencies/github_deps/post_train_base_deps.txt'
266266
maxtext_sha: ${{ needs.build_and_upload_maxtext_package.outputs.maxtext_sha }}
267267

268268
maxtext_post_training_tpu_unit_tests:
@@ -284,7 +284,7 @@ jobs:
284284
tf_force_gpu_allow_growth: false
285285
container_resource_option: "--privileged"
286286
is_scheduled_run: ${{ github.event_name == 'schedule' }}
287-
extra_pip_deps_file: 'src/install_maxtext_extra_deps/extra_post_train_base_deps_from_github.txt'
287+
extra_pip_deps_file: 'src/dependencies/github_deps/post_train_base_deps.txt'
288288
maxtext_sha: ${{ needs.build_and_upload_maxtext_package.outputs.maxtext_sha }}
289289

290290
maxtext_gpu_integration_tests:

.github/workflows/run_pathways_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
source .venv/bin/activate
8686
maxtext_wheel=$(ls maxtext-*-py3-none-any.whl 2>/dev/null)
8787
uv pip install ${maxtext_wheel}[tpu] --resolution=lowest
88-
uv pip install -r src/install_maxtext_extra_deps/extra_deps_from_github.txt
88+
uv pip install -r src/dependencies/github_deps/pre_train_deps.txt
8989
python3 --version
9090
python3 -m pip freeze
9191
- name: Copy test assets files

.github/workflows/run_tests_against_package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
source .venv/bin/activate
9797
maxtext_wheel=$(ls maxtext-*-py3-none-any.whl 2>/dev/null)
9898
uv pip install ${maxtext_wheel}[${MAXTEXT_PACKAGE_EXTRA}] --resolution=lowest
99-
uv pip install -r src/install_maxtext_extra_deps/extra_deps_from_github.txt
99+
uv pip install -r src/dependencies/github_deps/pre_train_deps.txt
100100
python3 --version
101101
python3 -m pip freeze
102102
uv pip install pytest-cov

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120
os.path.join("run_maxtext", "run_maxtext_via_multihost_runner.md"),
121121
os.path.join("reference", "core_concepts", "llm_calculator.ipynb"),
122122
os.path.join("reference", "api_generated", "modules.rst"),
123-
os.path.join("reference", "api_generated", "install_maxtext_extra_deps.rst"),
124-
os.path.join("reference", "api_generated", "install_maxtext_extra_deps.install_github_deps.rst"),
123+
os.path.join("reference", "api_generated", "dependencies.github_deps.rst"),
124+
os.path.join("reference", "api_generated", "dependencies.github_deps.install_pre_train_deps.rst"),
125125
]
126126

127127

docs/install_maxtext.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ To update dependencies, you will follow these general steps:
111111
1. **Modify Base Requirements**: Update the desired dependencies in `base_requirements/requirements.txt` or the hardware-specific files (`base_requirements/tpu-base-requirements.txt`, `base_requirements/gpu-base-requirements.txt`).
112112
2. **Generate New Files**: Run the `seed-env` CLI tool to generate new, fully-pinned requirements files based on your changes.
113113
3. **Update Project Files**: Copy the newly generated files into the `generated_requirements/` directory.
114-
4. **Handle GitHub Dependencies**: Move any dependencies that are installed directly from GitHub from the generated files to `src/install_maxtext_extra_deps/extra_deps_from_github.txt`.
114+
4. **Handle GitHub Dependencies**: Move any dependencies that are installed directly from GitHub from the generated files to `src/dependencies/github_deps/pre_train_deps.txt`.
115115
5. **Verify**: Test the new dependencies to ensure the project installs and runs correctly.
116116

117117
The following sections provide detailed instructions for each step.
@@ -169,7 +169,7 @@ After generating the new requirements, you need to update the files in the MaxTe
169169
- Move `generated_tpu_artifacts/tpu-requirements.txt` to `generated_requirements/tpu-requirements.txt`.
170170
- Move `generated_gpu_artifacts/cuda12-requirements.txt` to `generated_requirements/cuda12-requirements.txt`.
171171

172-
2. **Update `extra_deps_from_github.txt` (if necessary):**
172+
2. **Update `pre_train_deps.txt` (if necessary):**
173173
Currently, MaxText uses a few dependencies, such as `mlperf-logging` and `google-jetstream`, that are installed directly from GitHub source. These are defined in `base_requirements/requirements.txt`, and the `seed-env` tool will carry them over to the generated requirements files.
174174

175175
## Step 5: Verify the New Dependencies

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Repository = "https://github.com/AI-Hypercomputer/maxtext.git"
4040
allow-direct-references = true
4141

4242
[tool.hatch.build.targets.wheel]
43-
packages = ["src/MaxText", "src/maxtext", "src/install_maxtext_extra_deps", "src/dependencies"]
43+
packages = ["src/MaxText", "src/maxtext", "src/dependencies/github_deps", "src/dependencies"]
4444

4545
# TODO: Add this hook back when it handles device-type parsing
4646
# [tool.hatch.build.targets.wheel.hooks.custom]
4747
# path = "build_hooks.py"
4848

4949
[project.scripts]
50-
install_maxtext_tpu_github_deps = "install_maxtext_extra_deps.install_github_deps:main"
51-
install_maxtext_cuda12_github_deps = "install_maxtext_extra_deps.install_github_deps:main"
52-
install_maxtext_tpu_post_train_extra_deps = "install_maxtext_extra_deps.install_post_train_extra_deps:main"
50+
install_maxtext_tpu_github_deps = "dependencies.github_deps.install_pre_train_deps:main"
51+
install_maxtext_cuda12_github_deps = "dependencies.github_deps.install_pre_train_deps:main"
52+
install_maxtext_tpu_post_train_extra_deps = "dependencies.github_deps.install_post_train_deps:main"
5353
build_maxtext_docker_image = "dependencies.scripts.build_maxtext_docker_image:main"
5454
upload_maxtext_docker_image = "dependencies.scripts.upload_maxtext_docker_image:main"

src/dependencies/dockerfiles/maxtext_gpu_dependencies.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ ENV MAXTEXT_REPO_ROOT=/deps
5353
WORKDIR /deps
5454

5555
# Copy setup files and dependency files separately for better caching
56+
COPY ${PACKAGE_DIR}/dependencies/github_deps/ src/dependencies/github_deps/
5657
COPY ${PACKAGE_DIR}/dependencies/requirements/ src/dependencies/requirements/
5758
COPY ${PACKAGE_DIR}/dependencies/scripts/ src/dependencies/scripts/
58-
COPY ${PACKAGE_DIR}/install_maxtext_extra_deps/ src/install_maxtext_extra_deps/
5959
COPY ${PACKAGE_DIR}/maxtext/integration/vllm/ src/MaxText/integration/vllm/
6060

6161
# Install dependencies - these steps are cached unless the copied files change

src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ ENV MAXTEXT_REPO_ROOT=/deps
5050
WORKDIR /deps
5151

5252
# Copy setup files and dependency files separately for better caching
53+
COPY ${PACKAGE_DIR}/dependencies/github_deps/ src/dependencies/github_deps/
5354
COPY ${PACKAGE_DIR}/dependencies/requirements/ src/dependencies/requirements/
5455
COPY ${PACKAGE_DIR}/dependencies/scripts/ src/dependencies/scripts/
55-
COPY ${PACKAGE_DIR}/install_maxtext_extra_deps/ src/install_maxtext_extra_deps/
5656
COPY ${PACKAGE_DIR}/maxtext/integration/vllm/ src/maxtext/integration/vllm/
5757

5858
# Copy the custom libtpu.so file if it exists
File renamed without changes.

src/install_maxtext_extra_deps/install_post_train_extra_deps.py renamed to src/dependencies/github_deps/install_post_train_deps.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""Installs extra dependencies from a requirements file using uv.
1616
1717
This script is designed to be run to install dependencies specified in
18-
'extra_post_train_deps_from_github.txt', which is expected to be in the same directory.
18+
'post_train_deps.txt', which is expected to be in the same directory.
1919
It first ensures 'uv' is installed and then uses it to install the packages
2020
listed in the requirements file.
2121
"""
@@ -28,22 +28,22 @@
2828

2929
def main():
3030
"""
31-
Installs extra dependencies specified in extra_post_train_deps_from_github.txt using uv.
31+
Installs extra dependencies specified in post_train_deps.txt using uv.
3232
33-
This script looks for 'extra_post_train_deps_from_github.txt' relative to its own location.
33+
This script looks for 'post_train_deps.txt' relative to its own location.
3434
It executes 'uv pip install -r <path_to_extra_deps.txt> --resolution=lowest'.
3535
"""
3636
script_dir = Path(__file__).resolve().parent
3737

3838
os.environ["VLLM_TARGET_DEVICE"] = "tpu"
3939

40-
# Adjust this path if your extra_post_train_deps_from_github.txt is in a different location,
41-
# e.g., script_dir / "data" / "extra_post_train_deps_from_github.txt"
42-
extra_deps_file = script_dir / "extra_post_train_deps_from_github.txt"
40+
# Adjust this path if your post_train_deps.txt is in a different location,
41+
# e.g., script_dir / "data" / "post_train_deps.txt"
42+
extra_deps_file = script_dir / "post_train_deps.txt"
4343

4444
if not extra_deps_file.exists():
4545
print(f"Error: '{extra_deps_file}' not found.")
46-
print("Please ensure 'extra_post_train_deps_from_github.txt' is in the correct location relative to the script.")
46+
print("Please ensure 'post_train_deps.txt' is in the correct location relative to the script.")
4747
sys.exit(1)
4848
# Check if 'uv' is available in the environment
4949
try:

0 commit comments

Comments
 (0)