Skip to content

Commit

Permalink
2024-11-02 nightly release (09cf982)
Browse files Browse the repository at this point in the history
  • Loading branch information
pytorchbot committed Nov 2, 2024
1 parent 3ab6302 commit 848beb5
Show file tree
Hide file tree
Showing 19 changed files with 256 additions and 179 deletions.
2 changes: 1 addition & 1 deletion .ci/docker/ci_commit_pins/pytorch.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bd5482c7c3e1197e10c46ff739027f917d9c1fcc
e47e8794499a4a0130ff4efb8713ff93f4b40c36
2 changes: 1 addition & 1 deletion .ci/docker/common/install_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ install_ubuntu() {
apt-get install -y --no-install-recommends clang-"$CLANG_VERSION"
apt-get install -y --no-install-recommends llvm-"$CLANG_VERSION"
# Also require LLD linker from llvm and libomp to build PyTorch from source
apt-get install -y lld "libomp-${CLANG_VERSION}-dev"
apt-get install -y lld "libomp-${CLANG_VERSION}-dev" "libc++-${CLANG_VERSION}-dev"

# Use update-alternatives to make this version the default
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-"$CLANG_VERSION" 50
Expand Down
2 changes: 1 addition & 1 deletion .ci/docker/requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mpmath==1.3.0
numpy==1.22.0; python_version == '3.10'
numpy==1.21.3; python_version == '3.10'
numpy==1.23.2; python_version == '3.11'
numpy; python_version >= '3.12'
PyYAML==6.0.1
Expand Down
5 changes: 3 additions & 2 deletions .ci/scripts/setup-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ else
fi

# As Linux job is running inside a Docker container, all of its dependencies
# have already been installed
install_executorch
# have already been installed, so we use PyTorch build from source here instead
# of nightly. This allows CI to test against latest commits from PyTorch
install_executorch "use-pt-pinned-commit"
build_executorch_runner "${BUILD_TOOL}"
6 changes: 4 additions & 2 deletions .ci/scripts/setup-qnn-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ install_qnn() {
}

setup_libc++() {
clang_version=$1
sudo apt-get update
pkgs_to_check=('libc++-dev')
pkgs_to_check=("libc++-${clang_version}-dev")
j=0
while [ $j -lt ${#pkgs_to_check[*]} ]; do
install_status=$(verify_pkg_installed ${pkgs_to_check[$j]})
Expand All @@ -47,5 +48,6 @@ setup_libc++() {
done
}

setup_libc++
# This needs to match with the clang version from the Docker image
setup_libc++ 12
install_qnn
7 changes: 5 additions & 2 deletions .ci/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ install_executorch() {
which pip
# Install executorch, this assumes that Executorch is checked out in the
# current directory.
# TODO(T199538337): clean up install scripts to use install_requirements.sh
./install_requirements.sh --pybind xnnpack
if [[ "${1:-}" == "use-pt-pinned-commit" ]]; then
./install_requirements.sh --pybind xnnpack --use-pt-pinned-commit
else
./install_requirements.sh --pybind xnnpack
fi
# Just print out the list of packages for debugging
pip list
}
Expand Down
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Summary
[PLEASE REMOVE] See [CONTRIBUTING.md's Pull Requests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#pull-requests) for ExecuTorch PR guidelines.

[PLEASE REMOVE] If this PR closes an issue, please add a `Fixes #<issue-id>` line.

[PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: <area>" label. For a list of available release notes labels, check out [CONTRIBUTING.md's Pull Requests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#pull-requests).

### Test plan
[PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable.
7 changes: 7 additions & 0 deletions .github/workflows/_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
.ci/scripts/setup-linux.sh cmake
# Install llama3_2_vision dependencies.
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
# Run pytest with coverage
pytest -n auto --cov=./ --cov-report=xml
# Run gtest
Expand Down Expand Up @@ -67,6 +70,10 @@ jobs:
${CONDA_RUN} --no-capture-output \
.ci/scripts/setup-macos.sh cmake
# Install llama3_2_vision dependencies.
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
./examples/models/llama3_2_vision/install_requirements.sh
# Run pytest with coverage
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
# Run gtest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
docker-image: executorch-ubuntu-22.04-arm-sdk
submodules: 'true'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
script: |
# The generic Linux job chooses to use base env, not the one setup by the image
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
Expand All @@ -162,6 +163,7 @@ jobs:
docker-image: executorch-ubuntu-22.04-arm-sdk
submodules: 'true'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
script: |
# The generic Linux job chooses to use base env, not the one setup by the image
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
Expand Down
17 changes: 15 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,27 @@ for basics.
- Give the PR a clear and thorough description. Don't just describe what the PR
does: the diff will do that. Explain *why* you are making this change, in a
way that will make sense to someone years from now.
- Add the line `Test Plan:` (with that spelling, capitalization, and trailing
colon character), followed by lines containing repeatable instructions for
- Explain how you have tested your changes by including repeatable instructions for
testing the PR.
- If you added tests, this can be as simple as the command you used to run the
tests.
- If you tested the PR manually, include the steps and the outputs. Help a
future editor understand how to test the code that you're modifying
today.
- If your PR contains or is representative of a feature/bug fix that should be
called out in the release notes, please add a label for "Release notes: \<area\>",
where \<area\> describes which part of ExecuTorch the change pertains to, e.g.
"Release notes: runtime". Here are all of the categories:
- `Release notes: runtime`: changes related to the core runtime which loads the program methods, initializes delegates, and runs the lowered graph.
- `Release notes: exir`: changes to any internal representations, such as any edge-related dialects. Also any changes to passes that may modify the exir, such as memory planning.
- `Release notes: quantization`: changes to quantization.
- `Release notes: ops & kernels`: changes to the opset and any new / changed kernel implementations.
- `Release notes: api`: changes to public facing apis (any interfaces, pybinded runtime methods, etc.).
- `Release notes: backends`: changes to any of the backend delegates.
- `Release notes: build`: changes related to the build system, including major dependency upgrades, notable build flags, optimizations, etc.
- `Release notes: devtools`: changes to any of ExecuTorch's developer tools, for example the debugger & profiler.
- `Release notes: examples`: changes to any code under `examples/`.
- `Release notes: misc`: anything notable that doesn't belong in the above categories.
- See https://github.com/pytorch/executorch/pull/3612 for an example PR that
follows this advice.
1. Before asking for a review, ensure that all [CI (continuous integration)
Expand Down
4 changes: 2 additions & 2 deletions backends/apple/coreml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To quantize a Program in a Core ML favored way, the client may utilize **CoreMLQ
import torch
import executorch.exir

from torch._export import capture_pre_autograd_graph
from torch.export import export_for_training
from torch.ao.quantization.quantize_pt2e import (
convert_pt2e,
prepare_pt2e,
Expand Down Expand Up @@ -93,7 +93,7 @@ class Model(torch.nn.Module):
source_model = Model()
example_inputs = (torch.randn((1, 3, 256, 256)), )

pre_autograd_aten_dialect = capture_pre_autograd_graph(model, example_inputs)
pre_autograd_aten_dialect = export_for_training(model, example_inputs).module()

quantization_config = LinearQuantizerConfig.from_dict(
{
Expand Down
11 changes: 5 additions & 6 deletions docs/source/llm/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ import torch

from executorch.exir import EdgeCompileConfig, to_edge
from torch.nn.attention import sdpa_kernel, SDPBackend
from torch._export import capture_pre_autograd_graph
from torch.export import export
from torch.export import export, export_for_training

from model import GPT

Expand All @@ -170,7 +169,7 @@ dynamic_shape = (
# Trace the model, converting it to a portable intermediate representation.
# The torch.no_grad() call tells PyTorch to exclude training-specific logic.
with torch.nn.attention.sdpa_kernel([SDPBackend.MATH]), torch.no_grad():
m = capture_pre_autograd_graph(model, example_inputs, dynamic_shapes=dynamic_shape)
m = export_for_training(model, example_inputs, dynamic_shapes=dynamic_shape).module()
traced_model = export(m, example_inputs, dynamic_shapes=dynamic_shape)

# Convert the model into a runnable ExecuTorch program.
Expand Down Expand Up @@ -462,7 +461,7 @@ from executorch.exir import EdgeCompileConfig, to_edge
import torch
from torch.export import export
from torch.nn.attention import sdpa_kernel, SDPBackend
from torch._export import capture_pre_autograd_graph
from torch.export import export_for_training

from model import GPT

Expand All @@ -489,7 +488,7 @@ dynamic_shape = (
# Trace the model, converting it to a portable intermediate representation.
# The torch.no_grad() call tells PyTorch to exclude training-specific logic.
with torch.nn.attention.sdpa_kernel([SDPBackend.MATH]), torch.no_grad():
m = capture_pre_autograd_graph(model, example_inputs, dynamic_shapes=dynamic_shape)
m = export_for_training(model, example_inputs, dynamic_shapes=dynamic_shape).module()
traced_model = export(m, example_inputs, dynamic_shapes=dynamic_shape)

# Convert the model into a runnable ExecuTorch program.
Expand Down Expand Up @@ -635,7 +634,7 @@ xnnpack_quant_config = get_symmetric_quantization_config(
xnnpack_quantizer = XNNPACKQuantizer()
xnnpack_quantizer.set_global(xnnpack_quant_config)

m = capture_pre_autograd_graph(model, example_inputs)
m = export_for_training(model, example_inputs).module()

# Annotate the model for quantization. This prepares the model for calibration.
m = prepare_pt2e(m, xnnpack_quantizer)
Expand Down
3 changes: 3 additions & 0 deletions examples/models/llama3_2_vision/preprocess/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class PreprocessConfig:
max_num_tiles: int = 4
tile_size: int = 224
antialias: bool = False
# Used for reference eager model from torchtune.
resize_to_max_canvas: bool = False
possible_resolutions: Optional[List[Tuple[int, int]]] = None


class CLIPImageTransformModel(EagerModelBase):
Expand Down
Loading

0 comments on commit 848beb5

Please sign in to comment.