Skip to content

Commit 14931f6

Browse files
authored
support resume training (Oneflow-Inc#90)
1 parent 6d558f6 commit 14931f6

File tree

13 files changed

+423
-327
lines changed

13 files changed

+423
-327
lines changed

.clang-format

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Language: Cpp
2+
AccessModifierOffset: -1
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlinesLeft: true
7+
AlignOperands: true
8+
AlignTrailingComments: true
9+
AllowAllParametersOfDeclarationOnNextLine: true
10+
AllowShortBlocksOnASingleLine: true
11+
AllowShortCaseLabelsOnASingleLine: true
12+
AllowShortFunctionsOnASingleLine: All
13+
AllowShortIfStatementsOnASingleLine: true
14+
AllowShortLoopsOnASingleLine: true
15+
AlwaysBreakAfterDefinitionReturnType: None
16+
AlwaysBreakAfterReturnType: None
17+
AlwaysBreakBeforeMultilineStrings: false
18+
AlwaysBreakTemplateDeclarations: true
19+
BinPackArguments: true
20+
BinPackParameters: true
21+
BraceWrapping:
22+
AfterClass: true
23+
AfterControlStatement: false
24+
AfterEnum: false
25+
AfterFunction: false
26+
AfterNamespace: false
27+
AfterObjCDeclaration: false
28+
AfterStruct: false
29+
AfterUnion: false
30+
BeforeCatch: false
31+
BeforeElse: false
32+
IndentBraces: false
33+
BreakBeforeBinaryOperators: NonAssignment
34+
BreakBeforeBraces: Attach
35+
BreakBeforeTernaryOperators: true
36+
BreakConstructorInitializersBeforeComma: false
37+
BreakAfterJavaFieldAnnotations: false
38+
BreakStringLiterals: true
39+
ColumnLimit: 100
40+
CommentPragmas: '^ IWYU pragma:'
41+
BreakBeforeInheritanceComma: false
42+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
43+
ConstructorInitializerIndentWidth: 4
44+
ContinuationIndentWidth: 4
45+
Cpp11BracedListStyle: true
46+
DisableFormat: false
47+
ExperimentalAutoDetectBinPacking: false
48+
FixNamespaceComments: true
49+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
50+
IncludeCategories:
51+
- Regex: '^<.*\.h>'
52+
Priority: 1
53+
- Regex: '^<.*'
54+
Priority: 2
55+
- Regex: '.*'
56+
Priority: 3
57+
IncludeIsMainRegex: '([-_](test|unittest))?$'
58+
IndentCaseLabels: true
59+
IndentWidth: 2
60+
IndentWrappedFunctionNames: false
61+
JavaScriptQuotes: Leave
62+
JavaScriptWrapImports: true
63+
KeepEmptyLinesAtTheStartOfBlocks: false
64+
MacroBlockBegin: ''
65+
MacroBlockEnd: ''
66+
MaxEmptyLinesToKeep: 1
67+
NamespaceIndentation: None
68+
ObjCBlockIndentWidth: 2
69+
ObjCSpaceAfterProperty: false
70+
ObjCSpaceBeforeProtocolList: false
71+
PenaltyBreakBeforeFirstCallParameter: 1
72+
PenaltyBreakComment: 300
73+
PenaltyBreakFirstLessLess: 120
74+
PenaltyBreakString: 1000
75+
PenaltyExcessCharacter: 1000000
76+
PenaltyReturnTypeOnItsOwnLine: 200
77+
PointerAlignment: Left
78+
ReflowComments: true
79+
SortIncludes: false
80+
SpaceAfterCStyleCast: false
81+
SpaceAfterTemplateKeyword: false
82+
SpaceBeforeAssignmentOperators: true
83+
SpaceBeforeParens: ControlStatements
84+
SpaceInEmptyParentheses: false
85+
SpacesBeforeTrailingComments: 2
86+
SpacesInAngles: false
87+
SpacesInContainerLiterals: true
88+
SpacesInCStyleCastParentheses: false
89+
SpacesInParentheses: false
90+
SpacesInSquareBrackets: false
91+
Standard: Auto
92+
TabWidth: 8
93+
UseTab: Never

.github/workflows/py.yml

+32
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,38 @@ jobs:
3939
isort --check .
4040
black -l 100 --check .
4141
flake8 .
42+
43+
- name: Please request CI again
44+
if: ${{ failure() }}
45+
run: |
46+
exit 1
47+
48+
run_unittest:
49+
name: unit tests
50+
runs-on: ubuntu-18.04
51+
if: github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot')
52+
steps:
53+
- uses: actions/checkout@v2
54+
55+
- name: Set up Python 3.6
56+
uses: actions/setup-python@v2
57+
with:
58+
python-version: 3.6
59+
60+
- name: Install dependencies
61+
run: |
62+
python -m pip install --upgrade pip
63+
python -m pip install --pre oneflow -f https://staging.oneflow.info/branch/master/cu112
64+
python -m pip install pybind11
65+
66+
- name: Build and install
67+
run: |
68+
python -m pip install -e .
69+
python -m pip install flowvision==0.0.6
70+
71+
- name: Run unittest
72+
run: |
73+
cd dev && bash run_unittest.sh
4274
4375
- name: Please request CI again
4476
if: ${{ failure() }}

Makefile

-9
This file was deleted.

dev/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Some scripts for developers to use, include:
3+
4+
- `linter.sh`: lint the codebase before commit.
5+
- `run_unittest.sh`: run unittest for codebase.

dev/linter.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash -e
2+
3+
# cd to libai project root
4+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
5+
6+
{
7+
black --version | grep -E "21\." > /dev/null
8+
} || {
9+
echo "Linter requires 'black==21.*' !"
10+
exit 1
11+
}
12+
13+
ISORT_VERSION=$(isort --version-number)
14+
if [[ "$ISORT_VERSION" != 5.10.1 ]]; then
15+
echo "Linter requires isort==5.10.1 !"
16+
exit 1
17+
fi
18+
19+
set -v
20+
21+
echo "Running isort ..."
22+
isort . --atomic
23+
24+
echo "Running black ..."
25+
black -l 100 .
26+
27+
echo "Running flake8 ..."
28+
if [ -x "$(command -v flake8-3)" ]; then
29+
flake8-3 .
30+
else
31+
python3 -m flake8 .
32+
fi
33+
34+
echo "Running clang-format ..."
35+
find . -regex ".*\.\(cpp\|c\|cc\|cu\|cxx\|h\|hh\|hpp\|hxx\|tcc\|mm\|m\)" -print0 | xargs -0 clang-format -i
36+
37+
command -v arc > /dev/null && arc lint

dev/run_unittest.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash -e
2+
3+
4+
# cd to libai project root
5+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
6+
7+
python3 -m unittest discover -v -s ./tests

0 commit comments

Comments
 (0)