Skip to content

Commit 28c87c0

Browse files
authored
Merge branch 'main' into hoist-activation-quant
2 parents 8e855f7 + b3baac5 commit 28c87c0

83 files changed

Lines changed: 979 additions & 150 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/setup-macos.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ setup_macos_env_variables
116116
# buck2 atm
117117
install_buck
118118
brew install libomp
119-
install_pip_dependencies
120119

121120
# TODO(huydhn): Unlike our self-hosted runner, GitHub runner doesn't have access
122121
# to our infra, so compiler caching needs to be setup differently using GitHub
@@ -125,10 +124,17 @@ if [[ -z "${GITHUB_RUNNER:-}" ]]; then
125124
install_sccache
126125
fi
127126

127+
# Install pinned torch before requirements-ci.txt so torchsr's transitive
128+
# torch dep is satisfied by the existing install and pip does not pull a
129+
# separate copy from PyPI. sccache is initialized above so source-build
130+
# cache misses still hit the cache.
128131
print_cmake_info
129132
install_pytorch_and_domains
130-
# We build PyTorch from source here instead of using nightly. This allows CI to test against
131-
# the pinned commit from PyTorch
133+
134+
install_pip_dependencies
135+
136+
# install_executorch's --use-pt-pinned-commit skips re-installing torch since
137+
# install_pytorch_and_domains already installed the pinned build above.
132138
if [[ "$EDITABLE" == "true" ]]; then
133139
install_executorch --use-pt-pinned-commit --editable
134140
else

.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: 4 additions & 1 deletion
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

@@ -157,7 +159,8 @@ Okay, so I need to calculate 15% of 80."
157159
EXPECTED_QUANT_LORA_PREFIX="
158160
<|im_start|>user Calculate 15% of 80?<|im_end|><|im_start|>assistant
159161
To calculate 15% of 80, we can multiply 80 by 15/100.
160-
So, 15% of 80 is equal to (80 * 15) / 100 = 1200 / 100 = 12.
162+
80 * 15/100 = 12.
163+
So, 15% of 80 is 12.
161164
#### 12
162165
The answer is: 12<|im_end|>"
163166
EXPECTED_QUANT_LORA_ALTERNATE_PREFIX="

.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: 33 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

@@ -123,10 +127,38 @@ install_pytorch_and_domains() {
123127
if [[ "${torch_wheel_not_found}" == "1" ]]; then
124128
echo "No cached wheel found, continue with building PyTorch at ${TORCH_VERSION}"
125129

130+
# Install PyTorch's own build-time deps so the source build does not
131+
# silently inherit them from whatever else happens to be in the env
132+
# (e.g. executorch's requirements-ci.txt).
133+
pip install -r requirements-build.txt
126134
git submodule update --init --recursive
127135
USE_DISTRIBUTED=1 python setup.py bdist_wheel
128136
pip install "$(echo dist/*.whl)"
129137

138+
# Invariant: the basename setup.py just produced must match the cache
139+
# URL we'd reconstruct on the next run. If they diverge (someone edits
140+
# torch_wheel_name above, or PyTorch renames its wheels), the cache
141+
# will silently miss and every macOS run will fall back to a ~30-min
142+
# source build. Fail loudly so the regression is caught immediately.
143+
shopt -s nullglob
144+
local built_wheels=(dist/*.whl)
145+
shopt -u nullglob
146+
if [[ ${#built_wheels[@]} -ne 1 ]]; then
147+
echo "ERROR: expected exactly 1 wheel in dist/, found ${#built_wheels[@]}" >&2
148+
exit 1
149+
fi
150+
local built_wheel_name
151+
built_wheel_name=$(basename "${built_wheels[0]}")
152+
local expected_wheel_name="${torch_wheel_name//\%2B/+}"
153+
if [[ "${built_wheel_name}" != "${expected_wheel_name}" ]]; then
154+
echo "ERROR: built torch wheel name does not match cache URL key:" >&2
155+
echo " built: ${built_wheel_name}" >&2
156+
echo " expected: ${expected_wheel_name}" >&2
157+
echo "Fix torch_wheel_name construction in install_pytorch_and_domains" >&2
158+
echo "in .ci/scripts/utils.sh" >&2
159+
exit 1
160+
fi
161+
130162
# Only AWS runners have access to S3
131163
if command -v aws && [[ -z "${GITHUB_RUNNER:-}" ]]; then
132164
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+
}

0 commit comments

Comments
 (0)