Skip to content

Add privateuse1 situation support for _pin_memory property in PinMemory class #743

Add privateuse1 situation support for _pin_memory property in PinMemory class

Add privateuse1 situation support for _pin_memory property in PinMemory class #743

name: Run StatefulDataLoader Tests
on:
push:
branches:
- main
- release/*
tags:
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
# For PR created by ghstack
- gh/*/*/base
- release/*
jobs:
test:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python-version:
- 3.9
- "3.10"
- "3.11"
- "3.12"
- "3.13"
exclude:
- os: macos-latest
python-version: "3.13"
- os: windows-latest
python-version: "3.13"
steps:
- name: Get PyTorch Channel
shell: bash
run: |
if [[ "${{ github.base_ref }}" == release/* ]] || [[ "${{ github.ref }}" == refs/heads/release/* ]] || [[ "${{ github.ref }}" == refs/tags/v* ]]; then
PT_CHANNEL="https://download.pytorch.org/whl/test/cpu"
else
PT_CHANNEL="https://download.pytorch.org/whl/nightly/cpu"
fi
echo "value=$PT_CHANNEL" >> $GITHUB_OUTPUT
id: pytorch_channel
- name: Setup additional system libraries
if: startsWith( matrix.os, 'ubuntu' )
run: |
sudo add-apt-repository multiverse
sudo apt update
sudo apt install rar unrar libssl-dev libcurl4-openssl-dev zlib1g-dev
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup msbuild on Windows
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Set up Visual Studio shell
if: matrix.os == 'windows-latest'
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Check out source repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
pip3 install -r requirements.txt
pip3 install networkx
pip3 install --pre torch --index-url "${{ steps.pytorch_channel.outputs.value }}"
pip3 install cmake ninja
echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Build TorchData
run: |
pip3 install .
env:
BUILD_S3: 0
- name: Install test requirements
run: pip3 install -r test/requirements.txt
- name: Run StatefulDataLoader tests with pytest - dataloader
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_dataloader.py
- name: Run StatefulDataSampler tests with pytest - datasampler
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_sampler.py
- name: Run StatefulDataLoader tests with pytest - state_dict 0
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_state_dict.py -k _shard0
- name: Run StatefulDataLoader tests with pytest - state_dict 1
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_state_dict.py -k _shard1
- name: Run StatefulDataLoader tests with pytest - state_dict 2
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_state_dict.py -k _shard2
- name: Run StatefulDataLoader tests with pytest - state_dict 3
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_state_dict.py -k _shard3
- name: Run StatefulDataLoader HuggingFace tests
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ciflow/slow') }}
run: pytest --durations=0 --no-header -v test/stateful_dataloader/test_hugging_face.py