forked from facebookincubator/AITemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bing Xu
committed
Oct 3, 2022
0 parents
commit 44026ba
Showing
846 changed files
with
149,832 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline process engine. | ||
# See: https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. | ||
# See: https://circleci.com/docs/2.0/orb-intro/ | ||
orbs: | ||
# The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files | ||
# Orb commands and jobs help you with common scripting around a language/tool | ||
# so you dont have to copy and paste it everywhere. | ||
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python | ||
python: circleci/[email protected] | ||
|
||
# ------------------------------------------------------------------------------------- | ||
# Re-usable commands | ||
# ------------------------------------------------------------------------------------- | ||
setup_env: &setup_env | ||
- run: | ||
name: Setup environment | ||
command: | | ||
python3.8 --version | ||
python3.8 -m pip install --upgrade pip | ||
cd python | ||
python3.8 setup.py bdist_wheel | ||
sudo python3.8 -m pip install --no-input dist/*.whl | ||
cd .. | ||
python3.8 -m pip install pytest | ||
python3.8 -m pip install torch | ||
python3.8 -m pip install numpy | ||
python3.8 -m pip install jinja2 | ||
python3.8 -m pip install recordtype | ||
python3.8 -m pip install parameterized | ||
python3.8 -m pip install einops | ||
git submodule sync | ||
git submodule update --init | ||
echo 'export PYTHONPATH=$PWD/python:$PYTHONPATH' >> $BASH_ENV | ||
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> $BASH_ENV | ||
echo 'export CI_FLAG=CIRCLECI' >> $BASH_ENV | ||
echo 'export CACHE_DIR=$PWD/tests/ci_profile_cache' >> $BASH_ENV | ||
basic_tests: &basic_tests | ||
- run: | ||
name: Run tests | ||
command: | | ||
set -e | ||
TEST_FILES=$(circleci tests glob "tests/unittest/**/test_*.py" | grep -v benchmark | circleci tests split --split-by=timings) | ||
mkdir test-results | ||
python3.8 -m pytest $TEST_FILES --junitxml=test-results/junit.xml --verbose --continue-on-collection-errors -rA | ||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||
jobs: | ||
build-and-test: | ||
machine: | ||
image: ubuntu-2004-cuda-11.4:202110-01 | ||
# Check T101565170 for multi-gpu use cases. | ||
resource_class: gpu.nvidia.medium | ||
|
||
parallelism: 10 | ||
|
||
# Checkout the code as the first step. This is a dedicated CircleCI step. | ||
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default. | ||
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt. | ||
# Then run your tests! | ||
# CircleCI will report the results back to your VCS provider. | ||
steps: | ||
- checkout | ||
- <<: *setup_env | ||
- <<: *basic_tests | ||
- store_test_results: | ||
path: test-results | ||
|
||
# Invoke jobs via workflows | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
unittest: # This is the name of the workflow, feel free to change it to better match your workflow. | ||
# Inside the workflow, you define the jobs you want to run. | ||
jobs: | ||
- build-and-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlinesLeft: true | ||
AlignOperands: false | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: false | ||
ColumnLimit: 80 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ] | ||
IncludeCategories: | ||
- Regex: '^<.*\.h(pp)?>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IndentCaseLabels: true | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 2000000 | ||
PointerAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 8 | ||
UseTab: Never | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[flake8] | ||
select = B,C,E,F,P,W,B9 | ||
max-line-length = 80 | ||
# Main Explanation Docs: https://github.com/grantmcconnaughey/Flake8Rules | ||
ignore = | ||
# Black conflicts and overlaps. | ||
# Found in https://github.com/psf/black/issues/429 | ||
B950, # Line too long. | ||
E111, # Indentation is not a multiple of four. | ||
E115, # Expected an indented block (comment). | ||
E117, # Over-indented. | ||
E121, # Continuation line under-indented for hanging indent. | ||
E122, # Continuation line missing indentation or outdented. | ||
E123, # Closing bracket does not match indentation of opening bracket's line. | ||
E124, # Closing bracket does not match visual indentation. | ||
E125, # Continuation line with same indent as next logical line. | ||
E126, # Continuation line over-indented for hanging indent. | ||
E127, # Continuation line over-indented for visual indent. | ||
E128, # Continuation line under-indented for visual indent. | ||
E129, # Visually indented line with same indent as next logical line. | ||
E131, # Continuation line unaligned for hanging indent. | ||
E201, # Whitespace after '('. | ||
E202, # Whitespace before ')'. | ||
E203, # Whitespace before ':'. | ||
E221, # Multiple spaces before operator. | ||
E222, # Multiple spaces after operator. | ||
E225, # Missing whitespace around operator. | ||
E226, # Missing whitespace around arithmetic operator. | ||
E227, # Missing whitespace around bitwise or shift operator. | ||
E231, # Missing whitespace after ',', ';', or ':'. | ||
E241, # Multiple spaces after ','. | ||
E251, # Unexpected spaces around keyword / parameter equals. | ||
E252, # Missing whitespace around parameter equals. | ||
E261, # At least two spaces before inline comment. | ||
E262, # Inline comment should start with '# '. | ||
E265, # Block comment should start with '# '. | ||
E271, # Multiple spaces after keyword. | ||
E272, # Multiple spaces before keyword. | ||
E301, # Expected 1 blank line, found 0. | ||
E302, # Expected 2 blank lines, found 0. | ||
E303, # Too many blank lines (3). | ||
E305, # Expected 2 blank lines after end of function or class. | ||
E306, # Expected 1 blank line before a nested definition. | ||
E501, # Line too long (82 > 79 characters). | ||
E502, # The backslash is redundant between brackets. | ||
E701, # Multiple statements on one line (colon). | ||
E702, # Multiple statements on one line (semicolon). | ||
E703, # Statement ends with a semicolon. | ||
E704, # Multiple statements on one line (def). | ||
W291, # Trailing whitespace. | ||
W292, # No newline at end of file. | ||
W293, # Blank line contains whitespace. | ||
W391, # Blank line at end of file. | ||
W504, # Line break occurred after a binary operator. | ||
|
||
# Too opinionated. | ||
E265, # Block comment should start with '# '. | ||
E266, # Too many leading '#' for block comment. | ||
E402, # Module level import not at top of file. (Use cases like demandimport https://fburl.com/demandimport require statements before imports) | ||
E722, # Do not use bare except, specify exception instead. (Duplicate of B001) | ||
P207, # (Duplicate of B003) | ||
P208, # (Duplicate of C403) | ||
W503 # Line break occurred before a binary operator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Documentation | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install autodocsumm | ||
pip install sphinx_rtd_theme | ||
pip install sphinx_gallery | ||
pip install sphinxcontrib-inlinesyntaxhighlight | ||
pip install sphinx_toolbox | ||
pip install numpy | ||
pip install jinja2 | ||
pip install torch | ||
cd python | ||
python setup.py develop | ||
cd .. | ||
- name: Build documents with Sphinx | ||
run: | | ||
cd docs | ||
BUILD_DOCS=1 make html | ||
cd .. | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v2 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: './docs/build/html' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ufmt | ||
pip install click | ||
pip install flake8 | ||
- name: Analyzing the code with flake8 | ||
run: | | ||
echo "::add-matcher::tests/lint/flake8_problem_matcher.json" | ||
flake8 . | ||
- name: Analyzing the code with ufmt | ||
run: | | ||
ufmt diff python | ||
ufmt diff tests | ||
ufmt diff docs | ||
- name: Check Meta copyright header | ||
run: | | ||
python tests/lint/check_meta_header.py --path=./tests --fixit=False | ||
python tests/lint/check_meta_header.py --path=./python --fixit=False |
Oops, something went wrong.