Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0694bd4
add paddle wheel ci
SigureMo Nov 24, 2025
0c54bc0
upload-artifact v5
SigureMo Nov 24, 2025
3c69181
update script by copilot
SigureMo Nov 24, 2025
1e3503f
update script by copilot
SigureMo Nov 24, 2025
e8f73c1
dont deps on libphi_gpu.so
SigureMo Nov 24, 2025
bf61a12
upload-wheels-before-check
SigureMo Nov 24, 2025
5dffb71
use pytorch/manylinux2_28-builder:cpu
SigureMo Nov 24, 2025
b23501c
dont link libphi.so
SigureMo Nov 25, 2025
bbd3a7c
add ut
SigureMo Nov 25, 2025
7e066af
restore `bash -l {0}`
SigureMo Nov 25, 2025
cf2d2e6
create conda env before install packages
SigureMo Nov 25, 2025
101f109
fix .cuda().cpu()
SigureMo Nov 25, 2025
a5337d1
empty commit
SigureMo Nov 25, 2025
e5a4c64
use self-hosted runner
SigureMo Nov 26, 2025
03eef79
add openvino so ver check
SigureMo Nov 26, 2025
ac87fd6
show openvino out
SigureMo Nov 26, 2025
747a25a
empty commit
SigureMo Nov 26, 2025
a1b0660
force to install libopenvino=2025.0.0
SigureMo Nov 27, 2025
08af0d2
use gpu package to run ut
SigureMo Nov 27, 2025
8c5daf2
revert pin libopenvino version
SigureMo Nov 27, 2025
1cefa7d
empty commit
SigureMo Nov 28, 2025
7ce8920
install cpu package
SigureMo Nov 28, 2025
3742043
add release part in workflow
SigureMo Nov 28, 2025
1e5a37b
limit proxy scope to torchcodec
SigureMo Nov 28, 2025
a5165bb
cleanup check_openvino
SigureMo Nov 28, 2025
32c5165
fix workflow deps
SigureMo Nov 28, 2025
a79cbb5
cleanup import torch
SigureMo Nov 28, 2025
0c406b1
fix scope usage
SigureMo Nov 28, 2025
67d168a
skip python3.13 ut
SigureMo Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig
# https://editorconfig.org/

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{py,sh,ipynb}]
indent_size = 4

[*{.md,rst}]
indent_size = 3
185 changes: 185 additions & 0 deletions .github/workflows/paddle_wheel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Build Wheels for Paddle

on:
push:
branches: [main]
tags: ["v*"]
pull_request:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

permissions:
id-token: write
contents: write

defaults:
run:
shell: bash -l -eo pipefail {0}

jobs:
build-paddlecodec-wheel:
runs-on: ubuntu-latest
container:
image: pytorch/manylinux2_28-builder:cpu
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
miniforge-version: latest
activate-environment: build
python-version: ${{ matrix.python-version }}

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel setuptools

- name: Install PaddlePaddle nightly
run: |
pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/

- name: Run pre-build script
run: |
bash packaging/pre_build_script.sh

- name: Build wheel
run: |
# Use pre-built FFmpeg from PyTorch S3
export BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1
python -m build --wheel -vvv --no-isolation

- name: Upload wheel artifact
uses: actions/upload-artifact@v5
with:
name: paddlecodec-wheel-linux-py${{ matrix.python-version }}
path: dist/*.whl

- name: Run post-build script
run: |
bash packaging/post_build_script.sh

- name: List wheel contents
run: |
wheel_path=$(find dist -type f -name "*.whl")
echo "Wheel path: $wheel_path"
unzip -l $wheel_path

test-paddlecodec-wheel:
needs: build-paddlecodec-wheel
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Python 3.13 needs waiting PaddlePaddle self-hosted index upload setuptools
python-version: ["3.9", "3.10", "3.11", "3.12"]
# FFmpeg 8.0 depends on libopenvino.so.2520, PaddlePaddle CPU depends on libopenvino.so.2500
# There has some conflict causing test failures, but it works with PaddlePaddle GPU.
# We skip FFmpeg 8.0 tests for PaddlePaddle CPU builds for now.
ffmpeg-version: ["4.4.2", "5.1.2", "6.1.1", "7.0.1"]
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Download wheel artifact
uses: actions/download-artifact@v4
with:
name: paddlecodec-wheel-linux-py${{ matrix.python-version }}
path: dist/

- name: Install FFmpeg via conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
miniforge-version: latest
activate-environment: test
python-version: ${{ matrix.python-version }}

- name: Install FFmpeg from conda-forge
run: |
conda install "ffmpeg=${{ matrix.ffmpeg-version }}" -c conda-forge -y
ffmpeg -version

- name: Install PaddlePaddle nightly in conda env
run: |
pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/

- name: Install paddlecodec from wheel
run: |
wheel_path=$(find dist -type f -name "*.whl")
echo "Installing $wheel_path"
pip install $wheel_path -vvv

- name: Install test dependencies
run: |
pip install numpy pytest pillow

- name: Delete src folder
run: |
# Delete src/ to ensure we're testing the installed wheel, not source code
rm -rf src/
ls -la

- name: Run tests
run: |
pytest --override-ini="addopts=-v" -s test_paddle

publish-pypi:
runs-on: ubuntu-latest
name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
needs:
- test-paddlecodec-wheel
permissions:
id-token: write

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v6
with:
name: artifacts
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-release:
runs-on: ubuntu-latest
name: Publish to GitHub
if: "startsWith(github.ref, 'refs/tags/')"
needs:
- test-paddlecodec-wheel
permissions:
contents: write
steps:
- uses: actions/download-artifact@v6
with:
name: artifacts
path: dist/
- name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Publish to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
files: dist/*
tag_name: ${{ env.RELEASE_VERSION }}
2 changes: 1 addition & 1 deletion examples/decoding/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# :ref:`sampling_tuto_start`.

import paddle
paddle.compat.enable_torch_proxy()
paddle.compat.enable_torch_proxy(scope={"torchcodec"})

from typing import Optional
import torch
Expand Down
3 changes: 1 addition & 2 deletions src/torchcodec/_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ set(
TORCH_LIBRARIES
"${PADDLE_PATH}/base/libpaddle.so"
"${PADDLE_PATH}/libs/libcommon.so"
"${PADDLE_PATH}/libs/libphi.so"
# "${PADDLE_PATH}/libs/libphi.so" # currently libphi.so is static linked, we need remove it when it's shared linked
"${PADDLE_PATH}/libs/libphi_core.so"
"${PADDLE_PATH}/libs/libphi_gpu.so"
)
set(
TORCH_INSTALL_PREFIX
Expand Down
4 changes: 4 additions & 0 deletions src/torchcodec/_core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def disallow_in_graph(self, fn):
return fn
torch._dynamo = FakeDynamo("torch._dynamo")
torch._C._log_api_usage_once = lambda *args, **kwargs: None
# TODO: torch.__setattr__ should trigger paddle.__setattr__
import paddle
paddle._dynamo = FakeDynamo("torch._dynamo")
paddle._C._log_api_usage_once = lambda *args, **kwargs: None
# Note: We use disallow_in_graph because PyTorch does constant propagation of
# factory functions.
create_from_file = torch._dynamo.disallow_in_graph(
Expand Down
2 changes: 1 addition & 1 deletion src/torchcodec/decoders/_video_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
stream_index: Optional[int] = None,
dimension_order: Literal["NCHW", "NHWC"] = "NCHW",
num_ffmpeg_threads: int = 1,
device: Optional[Union[str, torch_device]] = "cpu",
device: Optional[Union[str, "torch_device"]] = "cpu",
seek_mode: Literal["exact", "approximate"] = "exact",
custom_frame_mappings: Optional[
Union[str, bytes, io.RawIOBase, io.BufferedReader]
Expand Down
Loading
Loading