Skip to content

Commit b94c014

Browse files
lsy323will-cromar
andauthored
Build torchvision from the pytorch pin in ansible (#6756) (#6960)
Co-authored-by: Will Cromar <[email protected]>
1 parent 8c33979 commit b94c014

File tree

5 files changed

+22
-29
lines changed

5 files changed

+22
-29
lines changed

infra/ansible/config/pip.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,3 @@ pip:
4949
# Packages that will be installed with the `--nodeps` flag.
5050
pkgs_nodeps:
5151
release_common:
52-
- torchvision
53-
- pillow

infra/ansible/e2e_tests.Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,15 @@ RUN ansible-playbook -vvv playbook.yaml -e "stage=release" -e "${ansible_vars}"
2323
# Copy test sources.
2424
RUN mkdir -p /src/pytorch/xla
2525
COPY --from=build /src/pytorch/xla/test /src/pytorch/xla/test
26-
# Copy ci_commit_pins from upstream
27-
RUN mkdir -p /src/pytorch/.github
28-
COPY --from=build /src/pytorch/.github/ci_commit_pins /src/pytorch/.github/ci_commit_pins
2926

3027
# Copy and install wheels.
3128
WORKDIR /tmp/wheels
32-
COPY --from=build /src/pytorch/dist/*.whl ./
33-
COPY --from=build /src/pytorch/xla/dist/*.whl ./
29+
COPY --from=build /dist/*.whl ./
3430

3531
RUN echo "Installing the following wheels" && ls *.whl
3632
RUN pip install *.whl
3733

3834
WORKDIR /
3935

4036
# Clean-up unused directories.
41-
RUN rm -rf /ansible /tmp/wheels
37+
RUN rm -rf /ansible /tmp/wheels

infra/ansible/roles/build_srcs/tasks/main.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,26 @@
8484
state: absent
8585
mode: '0755'
8686

87+
- name: Read Torchvision pin
88+
ansible.builtin.command: cat {{ (src_root, 'pytorch') | path_join }}/.github/ci_commit_pins/vision.txt
89+
register: torchvision_pin
90+
91+
- name: Build Torchvision wheel
92+
ansible.builtin.command:
93+
cmd: pip wheel --no-build-isolation --no-deps "git+https://github.com/pytorch/vision.git@{{ torchvision_pin.stdout }}"
94+
chdir: /dist
95+
environment: "{{ env_vars }}"
96+
97+
- name: Find Torchvision *.whl files in /dist
98+
ansible.builtin.find:
99+
path: /dist
100+
pattern: "torchvision*.whl"
101+
register: torchvision_wheels
102+
103+
- name: Install Torchvision wheel
104+
ansible.builtin.pip:
105+
name: "{{ torchvision_wheels.files | map(attribute='path') }}"
106+
87107
- name: "Tests"
88108
include_tasks: tests.yaml
89109
tags:

infra/ansible/roles/fetch_srcs/tasks/main.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,6 @@
2020
dest: "{{ (src_root, 'pytorch/xla') | path_join }}"
2121
version: "{{ xla_git_rev }}"
2222

23-
- name: Find *.diff files in pytorch/xla/openxla_patches
24-
ansible.builtin.find:
25-
path: "{{ (src_root, 'pytorch/xla/openxla_patches') | path_join }}"
26-
pattern: "*.diff"
27-
register: openxla_patches
28-
29-
- name: Apply patches to OpenXLA
30-
ansible.posix.patch:
31-
src: "{{ item }}"
32-
# Use source file on the target machine instead of the one where
33-
# the playbook is located. Has no effect when the target machine is
34-
# localhost.
35-
remote_src: true
36-
strip: 1
37-
ignore_whitespace: true
38-
basedir: "{{ (src_root, 'pytorch/xla/third_party/xla') | path_join }}"
39-
loop: "{{ openxla_patches.files | map(attribute='path') }}"
40-
ignore_errors: true
41-
4223
- name: "Tests"
4324
include_tasks: tests.yaml
4425
tags:

test/tpu/xla_test_job.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ spec:
4141
- bash
4242
- -cxe
4343
- |
44-
# Torchvision installed from a commit requires torch, need to install after torch is compiled.
45-
pip install --no-use-pep517 "git+https://github.com/pytorch/vision.git@$(cat /src/pytorch/.github/ci_commit_pins/vision.txt)"
4644
pip install expecttest==0.1.6
4745
pip install rich
4846
pip install torch_xla[pallas] -f https://storage.googleapis.com/jax-releases/jax_nightly_releases.html -f https://storage.googleapis.com/jax-releases/jaxlib_nightly_releases.html

0 commit comments

Comments
 (0)