Skip to content

Commit 65d2476

Browse files
committed
Merge branch 'main' of github.com:pytorch/torchcodec into mac_wheels_ci
2 parents 51010ba + 1fffd02 commit 65d2476

22 files changed

+668
-128
lines changed

.clang-format

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
AccessModifierOffset: -1
3+
AlignAfterOpenBracket: AlwaysBreak
4+
AlignConsecutiveMacros: false
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveBitFields: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Left
9+
AlignOperands: DontAlign
10+
AlignTrailingComments: false
11+
AllowAllArgumentsOnNextLine: true
12+
AllowAllConstructorInitializersOnNextLine: true
13+
AllowAllParametersOfDeclarationOnNextLine: false
14+
AllowShortEnumsOnASingleLine: true
15+
AllowShortBlocksOnASingleLine: Never
16+
AllowShortCaseLabelsOnASingleLine: false
17+
AllowShortFunctionsOnASingleLine: Empty
18+
AllowShortLambdasOnASingleLine: All
19+
AllowShortIfStatementsOnASingleLine: Never
20+
AllowShortLoopsOnASingleLine: false
21+
AlwaysBreakAfterReturnType: None
22+
AlwaysBreakBeforeMultilineStrings: true
23+
AlwaysBreakTemplateDeclarations: Yes
24+
BinPackArguments: false
25+
BinPackParameters: false
26+
BreakBeforeBinaryOperators: None
27+
BreakBeforeBraces: Attach
28+
BreakInheritanceList: BeforeColon
29+
BreakBeforeTernaryOperators: true
30+
BreakConstructorInitializers: BeforeColon
31+
BreakAfterJavaFieldAnnotations: false
32+
BreakStringLiterals: false
33+
ColumnLimit: 80
34+
CommentPragmas: '^ IWYU pragma:'
35+
CompactNamespaces: false
36+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
37+
ConstructorInitializerIndentWidth: 4
38+
ContinuationIndentWidth: 4
39+
Cpp11BracedListStyle: true
40+
DeriveLineEnding: true
41+
DerivePointerAlignment: false
42+
DisableFormat: false
43+
FixNamespaceComments: true
44+
ForEachMacros:
45+
- FOR_EACH
46+
- FOR_EACH_R
47+
- FOR_EACH_RANGE
48+
IncludeBlocks: Preserve
49+
IncludeCategories:
50+
- Regex: '^<.*\.h(pp)?>'
51+
Priority: 1
52+
- Regex: '^<.*'
53+
Priority: 2
54+
- Regex: '.*'
55+
Priority: 3
56+
IndentCaseLabels: true
57+
IndentCaseBlocks: false
58+
IndentGotoLabels: true
59+
IndentPPDirectives: None
60+
IndentExternBlock: AfterExternBlock
61+
IndentWidth: 2
62+
IndentWrappedFunctionNames: false
63+
InsertTrailingCommas: None
64+
JavaScriptQuotes: Leave
65+
JavaScriptWrapImports: true
66+
KeepEmptyLinesAtTheStartOfBlocks: false
67+
MacroBlockBegin: ''
68+
MacroBlockEnd: ''
69+
MaxEmptyLinesToKeep: 1
70+
NamespaceIndentation: None
71+
ObjCBinPackProtocolList: Auto
72+
ObjCBlockIndentWidth: 2
73+
ObjCBreakBeforeNestedBlockParam: true
74+
ObjCSpaceAfterProperty: false
75+
ObjCSpaceBeforeProtocolList: false
76+
PenaltyBreakAssignment: 2
77+
PenaltyBreakBeforeFirstCallParameter: 1
78+
PenaltyBreakComment: 300
79+
PenaltyBreakFirstLessLess: 120
80+
PenaltyBreakString: 1000
81+
PenaltyBreakTemplateDeclaration: 10
82+
PenaltyExcessCharacter: 1000000
83+
PenaltyReturnTypeOnItsOwnLine: 200
84+
PointerAlignment: Left
85+
ReflowComments: true
86+
SortIncludes: true
87+
SortUsingDeclarations: true
88+
SpaceAfterCStyleCast: false
89+
SpaceAfterLogicalNot: false
90+
SpaceAfterTemplateKeyword: true
91+
SpaceBeforeAssignmentOperators: true
92+
SpaceBeforeCpp11BracedList: false
93+
SpaceBeforeCtorInitializerColon: true
94+
SpaceBeforeInheritanceColon: true
95+
SpaceBeforeParens: ControlStatements
96+
SpaceBeforeRangeBasedForLoopColon: true
97+
SpaceInEmptyBlock: false
98+
SpaceInEmptyParentheses: false
99+
SpacesBeforeTrailingComments: 1
100+
SpacesInAngles: false
101+
SpacesInConditionalStatement: false
102+
SpacesInContainerLiterals: true
103+
SpacesInCStyleCastParentheses: false
104+
SpacesInParentheses: false
105+
SpacesInSquareBrackets: false
106+
SpaceBeforeSquareBrackets: false
107+
Standard: Latest
108+
TabWidth: 8
109+
UseCRLF: false
110+
UseTab: Never
111+
...

.github/workflows/cpp_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ jobs:
6565
Torch_DIR="${TORCH_PATH}/share/cmake/Torch"
6666
cmake .. -DTorch_DIR=$Torch_DIR -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON
6767
cmake --build .
68-
ctest
68+
ctest --output-on-failure
6969
popd

.github/workflows/docs.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ jobs:
2828
run: python -m pip install --upgrade pip
2929
- name: Install dependencies and FFmpeg
3030
run: |
31-
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
31+
# TODO: torchvision and torchaudio shouldn't be needed. They were only added
32+
# to silence an error as seen in https://github.com/pytorch/torchcodec/issues/203
33+
python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
3234
conda install "ffmpeg=7.0.1" pkg-config -c conda-forge
3335
ffmpeg -version
3436
- name: Build and install torchcodec

.github/workflows/lint.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ jobs:
3636
run: |
3737
python -m pip install pre-commit
3838
- name: Run pre-commit checks
39+
# Continue on error to display the formatting diff in case lint fails.
40+
continue-on-error: true
3941
run: |
4042
pre-commit run --all-files
43+
- name: Check to see what files pre-commit modified
44+
run: |
45+
git diff
4146
4247
mypy:
4348
runs-on: ubuntu-latest

.github/workflows/macos_wheel.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ defaults:
2525

2626
jobs:
2727
generate-matrix:
28-
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
28+
uses: scotts/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
2929
with:
3030
package-type: wheel
3131
os: macos-arm64
32-
test-infra-repository: pytorch/test-infra
32+
test-infra-repository: scotts/test-infra
3333
test-infra-ref: main
3434
with-xpu: disable
3535
with-rocm: disable
@@ -39,11 +39,11 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
name: Build and Upload Mac wheel
42-
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
42+
uses: scotts/test-infra/.github/workflows/build_wheels_macos.yml@main
4343
with:
4444
repository: pytorch/torchcodec
4545
ref: ""
46-
test-infra-repository: pytorch/test-infra
46+
test-infra-repository: scotts/test-infra
4747
test-infra-ref: main
4848
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
4949
post-script: packaging/post_build_script.sh

.pre-commit-config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ repos:
2727
hooks:
2828
- id: flake8
2929
args: [--config=.flake8]
30+
31+
- repo: https://github.com/pre-commit/mirrors-clang-format
32+
rev: v18.1.3
33+
hooks:
34+
- id: clang-format
35+
name: clang-format
36+
files: \.(cpp|hpp|c|h)$
37+
types: [file]

README.md

+17-18
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,28 @@ ffmpeg -f lavfi -i \
9595
## Installing TorchCodec
9696

9797
Note: if you're on MacOS, you'll need to [build from source](./CONTRIBUTING.md).
98-
Instructions below assume you're on Linux.
98+
The instructions below assume you're on Linux.
9999

100-
First install the latest stable version of PyTorch following the [official
101-
instructions](https://pytorch.org/get-started/locally/).
100+
1. Install the latest stable version of PyTorch following the
101+
[official instructions](https://pytorch.org/get-started/locally/). TorchCodec
102+
requires [PyTorch 2.4](https://pytorch.org/docs/2.4/).
102103

103-
Then:
104+
2. Install FFmpeg, if it's not already installed. Your Linux distribution probably
105+
comes with FFmpeg pre-installed. TorchCodec supports all major FFmpeg versions
106+
in [4, 7].
104107

105-
```bash
106-
pip install torchcodec
107-
```
108-
You will also need FFmpeg installed on your system, and TorchCodec decoding
109-
capabilities are determined by your underlying FFmpeg installation. There are
110-
different options to install FFmpeg e.g.:
111-
112-
```bash
113-
conda install ffmpeg
114-
# or
115-
conda install ffmpeg -c conda-forge
116-
```
108+
If FFmpeg is not already installed, or you need a later version, install it with:
117109

118-
Your Linux distribution probably comes with FFmpeg pre-installed as well.
119-
TorchCodec supports all major FFmpeg version in [4, 7].
110+
```bash
111+
conda install ffmpeg
112+
# or
113+
conda install ffmpeg -c conda-forge
114+
```
115+
3. Install TorchCodec:
120116

117+
```bash
118+
pip install torchcodec
119+
```
121120

122121
## Planned future work
123122

0 commit comments

Comments
 (0)