Skip to content

Commit 22a67e6

Browse files
Merge branch 'main' into remove_setup_flag
2 parents 11ec1e9 + ada8e35 commit 22a67e6

70 files changed

Lines changed: 811 additions & 134 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/scripts/download_hf_hub.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# Disable HF Xet storage to avoid stalled downloads on CI runners
4+
export HF_HUB_DISABLE_XET=1
5+
36
# Function to download files from the Hugging Face Hub
47
# Arguments:
58
# 1. model_id: The Hugging Face repository ID (e.g., "organization/model_name")

.ci/scripts/export_model_artifact.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ if [ -z "${1:-}" ]; then
6767
exit 1
6868
fi
6969

70+
# Disable HF Xet storage to avoid stalled downloads on CI runners
71+
export HF_HUB_DISABLE_XET=1
72+
7073
set -eux
7174

7275
DEVICE="$1"

.ci/scripts/test_huggingface_optimum_model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
import gc
33
import logging
44
import math
5+
import os
56
import shutil
67
import subprocess
78
import tempfile
89
import time
910
from pathlib import Path
1011
from typing import List
1112

13+
# Disable HF Xet storage to avoid stalled downloads on CI runners
14+
os.environ.setdefault("HF_HUB_DISABLE_XET", "1")
15+
1216
import torch
1317
from datasets import load_dataset
1418

.ci/scripts/test_lora.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# LICENSE file in the root directory of this source tree.
77

88
set -exu
9+
# Disable HF Xet storage to avoid stalled downloads on CI runners
10+
export HF_HUB_DISABLE_XET=1
911
# shellcheck source=/dev/null
1012
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1113

.ci/scripts/test_lora_multimethod.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# LICENSE file in the root directory of this source tree.
77

88
set -exu
9+
# Disable HF Xet storage to avoid stalled downloads on CI runners
10+
export HF_HUB_DISABLE_XET=1
911
# shellcheck source=/dev/null
1012
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1113

.ci/scripts/test_phi_3_mini.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# LICENSE file in the root directory of this source tree.
77

88
set -exu
9+
# Disable HF Xet storage to avoid stalled downloads on CI runners
10+
export HF_HUB_DISABLE_XET=1
911

1012
BUILD_TYPE=${1:-Debug}
1113
BUILD_DIR=${3:-cmake-out}

.ci/scripts/utils.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ install_pytorch_and_domains() {
105105
fi
106106
local python_version=$(python -c 'import platform; v=platform.python_version_tuple(); print(f"{v[0]}{v[1]}")')
107107
local torch_release=$(cat version.txt)
108-
local torch_short_hash=${TORCH_VERSION:0:7}
108+
# Download key must match the upload key below (basename of dist/*.whl,
109+
# which always carries setup.py's resolved +gitHASH). Branch-ref pins
110+
# like `release/2.11` would otherwise produce `+gitrelease` here and
111+
# never hit the cache.
112+
local torch_short_hash=$(git rev-parse --short=7 HEAD)
109113
local torch_wheel_path="cached_artifacts/pytorch/executorch/pytorch_wheels/${system_name}/${python_version}"
110114
local torch_wheel_name="torch-${torch_release}%2Bgit${torch_short_hash}-cp${python_version}-cp${python_version}-${platform:-}.whl"
111115

@@ -127,6 +131,30 @@ install_pytorch_and_domains() {
127131
USE_DISTRIBUTED=1 python setup.py bdist_wheel
128132
pip install "$(echo dist/*.whl)"
129133

134+
# Invariant: the basename setup.py just produced must match the cache
135+
# URL we'd reconstruct on the next run. If they diverge (someone edits
136+
# torch_wheel_name above, or PyTorch renames its wheels), the cache
137+
# will silently miss and every macOS run will fall back to a ~30-min
138+
# source build. Fail loudly so the regression is caught immediately.
139+
shopt -s nullglob
140+
local built_wheels=(dist/*.whl)
141+
shopt -u nullglob
142+
if [[ ${#built_wheels[@]} -ne 1 ]]; then
143+
echo "ERROR: expected exactly 1 wheel in dist/, found ${#built_wheels[@]}" >&2
144+
exit 1
145+
fi
146+
local built_wheel_name
147+
built_wheel_name=$(basename "${built_wheels[0]}")
148+
local expected_wheel_name="${torch_wheel_name//\%2B/+}"
149+
if [[ "${built_wheel_name}" != "${expected_wheel_name}" ]]; then
150+
echo "ERROR: built torch wheel name does not match cache URL key:" >&2
151+
echo " built: ${built_wheel_name}" >&2
152+
echo " expected: ${expected_wheel_name}" >&2
153+
echo "Fix torch_wheel_name construction in install_pytorch_and_domains" >&2
154+
echo "in .ci/scripts/utils.sh" >&2
155+
exit 1
156+
fi
157+
130158
# Only AWS runners have access to S3
131159
if command -v aws && [[ -z "${GITHUB_RUNNER:-}" ]]; then
132160
for wheel_path in dist/*.whl; do
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import os
2+
import re
3+
import sys
4+
5+
from github import Github
6+
7+
8+
def main() -> None:
9+
token = os.environ.get("GITHUB_TOKEN")
10+
11+
repo_owner = "pytorch"
12+
repo_name = "pytorch"
13+
pull_request_number = int(sys.argv[1])
14+
15+
g = Github(token)
16+
repo = g.get_repo(f"{repo_owner}/{repo_name}")
17+
pull_request = repo.get_pull(pull_request_number)
18+
pull_request_body = pull_request.body
19+
# PR without description
20+
if pull_request_body is None:
21+
return
22+
23+
# get issue number from the PR body
24+
if not re.search(r"#\d{1,6}", pull_request_body):
25+
print("The pull request does not mention an issue.")
26+
return
27+
issue_number = int(re.findall(r"#(\d{1,6})", pull_request_body)[0])
28+
issue = repo.get_issue(issue_number)
29+
issue_labels = issue.labels
30+
docathon_label_present = any(
31+
label.name == "docathon-2026" for label in issue_labels
32+
)
33+
34+
# if the issue has a docathon label, add all labels from the issue to the PR.
35+
if not docathon_label_present:
36+
print("The 'docathon-2026' label is not present in the issue.")
37+
return
38+
pull_request_labels = pull_request.get_labels()
39+
pull_request_label_names = [label.name for label in pull_request_labels]
40+
issue_label_names = [label.name for label in issue_labels]
41+
labels_to_add = [
42+
label
43+
for label in issue_label_names
44+
if label not in pull_request_label_names and label != "actionable"
45+
]
46+
if not labels_to_add:
47+
print("The pull request already has the same labels.")
48+
return
49+
pull_request.add_to_labels(*labels_to_add)
50+
print("Labels added to the pull request!")
51+
52+
53+
if __name__ == "__main__":
54+
main()
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Assign User on Comment
2+
3+
on:
4+
workflow_dispatch:
5+
issue_comment:
6+
types: [created]
7+
8+
jobs:
9+
assign:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
steps:
14+
- name: Check for "/assigntome" in comment
15+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
script: |
20+
const issueComment = context.payload.comment.body;
21+
const assignRegex = /\/assigntome/i;
22+
if (assignRegex.test(issueComment)) {
23+
const assignee = context.payload.comment.user.login;
24+
const issueNumber = context.payload.issue.number;
25+
try {
26+
const { data: issue } = await github.rest.issues.get({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
issue_number: issueNumber
30+
});
31+
const hasLabel = issue.labels.some(label => label.name === 'docathon-2026');
32+
if (hasLabel) {
33+
if (issue.assignee !== null) {
34+
await github.rest.issues.createComment({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
issue_number: issueNumber,
38+
body: "The issue is already assigned. Please pick an opened and unnasigned issue with the [docathon-2026 label](https://github.com/pytorch/executorch/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-2026)"
39+
});
40+
} else {
41+
await github.rest.issues.addAssignees({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
issue_number: issueNumber,
45+
assignees: [assignee]
46+
});
47+
}
48+
} else {
49+
const commmentMessage = "This issue does not have the correct label. Please pick an opened and unnasigned issue with the [docathon-2026 label](https://github.com/pytorch/executorch/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-2026)";
50+
await github.rest.issues.createComment({
51+
owner: context.repo.owner,
52+
repo: context.repo.repo,
53+
issue_number: issueNumber,
54+
body: commmentMessage
55+
});
56+
}
57+
} catch (error) {
58+
console.error(error);
59+
}
60+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docathon Labels Sync
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, edited]
6+
branches: [main]
7+
8+
jobs:
9+
check-labels:
10+
if: github.repository_owner == 'pytorch'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
with:
19+
fetch-depth: 1
20+
- name: Set up Python
21+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
22+
with:
23+
python-version: 3.x
24+
- name: Install dependencies
25+
run: |
26+
pip install requests==2.32.3
27+
pip install PyGithub==2.3.0
28+
- name: Run Python script
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: python ./.github/scripts/docathon-label-sync.py ${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)