Skip to content

Commit 27e3ad8

Browse files
authored
Add Github workflow to build and publish wheel to PyTorch Index nightly (#1392)
1 parent db52d57 commit 27e3ad8

File tree

3 files changed

+66
-7
lines changed

3 files changed

+66
-7
lines changed

.github/scripts/update_version.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version_file="assets/version.txt"
2+
init_file="torchtitan/__init__.py"
3+
if [[ -n "$BUILD_VERSION" ]]; then
4+
# Update the version in version.txt
5+
echo "$BUILD_VERSION" > "$version_file"
6+
# Create a variable named __version__ at the end of __init__.py
7+
echo "__version__ = \"$BUILD_VERSION\"" >> "$init_file"
8+
else
9+
echo "Error: BUILD_VERSION environment variable is not set or empty."
10+
exit 1
11+
fi
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build nightly wheels and publish to PyTorch Index
2+
3+
on:
4+
push:
5+
branches:
6+
- nightly
7+
workflow_dispatch:
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
generate-matrix:
15+
if: github.repository_owner == 'pytorch'
16+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
17+
with:
18+
package-type: wheel
19+
os: linux
20+
test-infra-repository: pytorch/test-infra
21+
test-infra-ref: main
22+
with-cuda: enable
23+
with-rocm: enable
24+
python-versions: '["3.10", "3.11", "3.12"]'
25+
build:
26+
needs: generate-matrix
27+
name: ${{ matrix.repository }}
28+
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
29+
strategy:
30+
fail-fast: false
31+
with:
32+
repository: pytorch/torchtitan
33+
ref: ""
34+
test-infra-repository: pytorch/test-infra
35+
test-infra-ref: main
36+
package-name: torchtitan
37+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
38+
pre-script: .github/scripts/update_version.sh
39+
trigger-event: ${{ github.event_name }}
40+
build-platform: 'python-build-package'

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ You may want to see how the model is defined or how parallelism techniques are a
8989

9090
## Installation
9191

92-
### Nightly
93-
94-
Coming soon.
92+
> [Install PyTorch](https://pytorch.org/get-started/locally/) before proceeding.
9593
9694
### Stable
9795

@@ -103,14 +101,24 @@ Or via conda:
103101
```sh
104102
conda install conda-forge::torchtitan
105103
```
106-
### Sources
107-
104+
105+
### Nightly
106+
107+
> This method requires the nightly build of PyTorch.
108+
109+
```sh
110+
pip install --pre torchtitan --index-url https://download.pytorch.org/whl/nightly/cu126
111+
```
112+
You can replace `cu126` with another version of cuda (e.g. `cu128`) or an AMD GPU (e.g. `rocm6.3`).
113+
114+
### From source
115+
116+
> This method requires the nightly build of PyTorch or PyTorch built from source.
117+
108118
```bash
109119
git clone https://github.com/pytorch/torchtitan
110120
cd torchtitan
111121
pip install -r requirements.txt
112-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu126 --force-reinstall
113-
[For AMD GPU] pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/rocm6.3 --force-reinstall
114122
```
115123

116124
### Downloading a tokenizer

0 commit comments

Comments
 (0)