Skip to content

Commit

Permalink
主仓同步
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyixuan30 committed Nov 5, 2024
2 parents 1087e50 + 71437a3 commit 96c4d7c
Show file tree
Hide file tree
Showing 50 changed files with 250 additions and 138 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.10.15
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: '3.10.15'
- name: Install pre-commit hook
run: |
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --all-files
- name: Format c/cuda codes with clang-format
uses: DoozyX/clang-format-lint-action@v0.11
uses: DoozyX/clang-format-lint-action@v0.18
with:
source: mmcv/ops/csrc
extensions: h,c,cpp,hpp,cu,cuh
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr_stage_test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: pr_stage_test

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

on:
pull_request:
paths-ignore:
Expand Down
16 changes: 11 additions & 5 deletions .pre-commit-config-zh-cn.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
exclude: ^tests/data/
repos:
- repo: https://gitee.com/openmmlab/mirrors-flake8
rev: 5.0.4
- repo: https://github.com/pre-commit/pre-commit
rev: v4.0.0
hooks:
- id: validate_manifest
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://gitee.com/openmmlab/mirrors-isort
Expand All @@ -13,7 +17,7 @@ repos:
hooks:
- id: yapf
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-yaml
Expand All @@ -39,6 +43,7 @@ repos:
- mdformat_frontmatter
- linkify-it-py
- repo: https://gitee.com/openmmlab/mirrors-docformatter
# TODO:https://github.com/PyCQA/docformatter/issues/289
rev: v1.3.1
hooks:
- id: docformatter
Expand All @@ -53,15 +58,16 @@ repos:
hooks:
- id: check-copyright
args: ["mmcv", "tests", "--excludes", "mmcv/ops"]
- repo: https://gitee.com/openmmlab/mirrors-mypy
rev: v0.812
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
hooks:
- id: mypy
exclude: |-
(?x)(
^test
| ^docs
)
additional_dependencies: ["types-setuptools", "types-requests"]
# - repo: local
# hooks:
# - id: clang-format
Expand Down
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
exclude: ^tests/data/
repos:
- repo: https://github.com/pre-commit/pre-commit
rev: v4.0.0
hooks:
- id: validate_manifest
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/PyCQA/isort
Expand All @@ -13,7 +17,7 @@ repos:
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-yaml
Expand All @@ -39,7 +43,7 @@ repos:
- mdformat_frontmatter
- linkify-it-py
- repo: https://github.com/myint/docformatter
rev: v1.3.1
rev: 06907d0
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
Expand All @@ -54,14 +58,15 @@ repos:
- id: check-copyright
args: ["mmcv", "tests", "--excludes", "mmcv/ops"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v1.2.0
hooks:
- id: mypy
exclude: |-
(?x)(
^test
| ^docs
)
additional_dependencies: ["types-setuptools", "types-requests"]
# - repo: local
# hooks:
# - id: clang-format
Expand Down
21 changes: 21 additions & 0 deletions docs/en/_static/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"Linux": [
{
"cuda": "12.1",
"torch": "2.4.x",
"mmcv": [
"2.2.0"
]
},
{
"cuda": "12.1",
"torch": "2.3.x",
Expand All @@ -22,6 +29,13 @@
"2.1.0"
]
},
{
"cuda": "11.8",
"torch": "2.4.x",
"mmcv": [
"2.2.0"
]
},
{
"cuda": "11.8",
"torch": "2.3.x",
Expand Down Expand Up @@ -376,6 +390,13 @@
"2.0.0rc2"
]
},
{
"cuda": "cpu",
"torch": "2.4.x",
"mmcv": [
"2.2.0"
]
},
{
"cuda": "cpu",
"torch": "2.3.x",
Expand Down
21 changes: 21 additions & 0 deletions docs/zh_cn/_static/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"Linux": [
{
"cuda": "12.1",
"torch": "2.4.x",
"mmcv": [
"2.2.0"
]
},
{
"cuda": "12.1",
"torch": "2.3.x",
Expand All @@ -22,6 +29,13 @@
"2.1.0"
]
},
{
"cuda": "11.8",
"torch": "2.4.x",
"mmcv": [
"2.2.0"
]
},
{
"cuda": "11.8",
"torch": "2.3.x",
Expand Down Expand Up @@ -376,6 +390,13 @@
"2.0.0rc2"
]
},
{
"cuda": "cpu",
"torch": "2.4.x",
"mmcv": [
"2.2.0"
]
},
{
"cuda": "cpu",
"torch": "2.3.x",
Expand Down
3 changes: 2 additions & 1 deletion mmcv/cnn/bricks/drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def drop_path(x: torch.Tensor,
residual blocks).
We follow the implementation
https://github.com/rwightman/pytorch-image-models/blob/a2727c1bf78ba0d7b5727f5f95e37fb7f8866b1f/timm/models/layers/drop.py # noqa: E501
https://github.com/rwightman/pytorch-image-models/blob/a2727c1bf78ba0d7b5727f5f95e37fb7f8866b1f/timm/models/layers/drop.py
# noqa: E501
"""
if drop_prob == 0. or not training:
return x
Expand Down
8 changes: 4 additions & 4 deletions mmcv/cnn/rfsearch/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self,
self.by_epoch = by_epoch

def init_model(self, model: nn.Module):
"""init model with search ability.
"""Init model with search ability.
Args:
model (nn.Module): pytorch model
Expand Down Expand Up @@ -132,7 +132,7 @@ def step(self, model: nn.Module, work_dir: str) -> None:
)

def estimate_and_expand(self, model: nn.Module) -> None:
"""estimate and search for RFConvOp.
"""Estimate and search for RFConvOp.
Args:
model (nn.Module): pytorch model
Expand All @@ -146,7 +146,7 @@ def wrap_model(self,
model: nn.Module,
search_op: str = 'Conv2d',
prefix: str = '') -> None:
"""wrap model to support searchable conv op.
"""Wrap model to support searchable conv op.
Args:
model (nn.Module): pytorch model
Expand Down Expand Up @@ -187,7 +187,7 @@ def set_model(self,
search_op: str = 'Conv2d',
init_rates: Optional[int] = None,
prefix: str = '') -> None:
"""set model based on config.
"""Set model based on config.
Args:
model (nn.Module): pytorch model
Expand Down
4 changes: 2 additions & 2 deletions mmcv/cnn/rfsearch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def write_to_json(config: dict, filename: str):
"""save config to json file.
"""Save config to json file.
Args:
config (dict): Config to be saved.
Expand All @@ -16,7 +16,7 @@ def write_to_json(config: dict, filename: str):


def expand_rates(dilation: tuple, config: dict) -> list:
"""expand dilation rate according to config.
"""Expand dilation rate according to config.
Args:
dilation (int): _description_
Expand Down
6 changes: 3 additions & 3 deletions mmcv/ops/active_rotated_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class ActiveRotatedFilterFunction(Function):
"""Encoding the orientation information and generating orientation-
sensitive features.
The details are described in the paper `Align Deep Features for Oriented
Object Detection <https://arxiv.org/abs/2008.09397>_`.
"""
The details are described in the paper
`Align Deep Features for Oriented Object Detection <https://arxiv.org/abs/2008.09397>_`.
""" # noqa: E501

@staticmethod
def forward(ctx, input: torch.Tensor,
Expand Down
2 changes: 1 addition & 1 deletion mmcv/ops/cc_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, in_channels: int) -> None:
self.in_channels = in_channels

def forward(self, x: torch.Tensor) -> torch.Tensor:
"""forward function of Criss-Cross Attention.
"""Forward function of Criss-Cross Attention.
Args:
x (torch.Tensor): Input feature with the shape of
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/chamfer_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class ChamferDistanceFunction(Function):
"""This is an implementation of the 2D Chamfer Distance.
It has been used in the paper `Oriented RepPoints for Aerial Object
Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`.
Detection (CVPR 2022)
<https://arxiv.org/abs/2105.11111>_`.
"""

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion mmcv/ops/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _output_size(ctx, input1):


class Correlation(nn.Module):
r"""Correlation operator
r"""Correlation operator.
This correlation operator works for optical flow correlation computation.
Expand Down
6 changes: 3 additions & 3 deletions mmcv/ops/csrc/common/cuda/bezier_align_cuda_kernel.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ __global__ void bezier_align_backward_cuda_kernel(
atomicAdd(offset_bottom_diff + y_high * width + x_high,
static_cast<T>(g4));
} // if
} // ix
} // iy
} // CUDA_1D_KERNEL_LOOP
} // ix
} // iy
} // CUDA_1D_KERNEL_LOOP
} // BezierAlignBackward

#endif // BEZIER_ALIGN_CUDA_KERNEL_CUH
6 changes: 3 additions & 3 deletions mmcv/ops/csrc/common/cuda/riroi_align_rotated_cuda_kernel.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ __global__ void riroi_align_rotated_backward_cuda_kernel(
g4 * l_var);

} // if
} // ix
} // iy
} // CUDA_1D_KERNEL_LOOP
} // ix
} // iy
} // CUDA_1D_KERNEL_LOOP
} // RiRoIAlignBackward

#endif // RIROI_ALIGN_ROTATED_CUDA_KERNEL_CUH
6 changes: 3 additions & 3 deletions mmcv/ops/csrc/common/cuda/roi_align_rotated_cuda_kernel.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ __global__ void roi_align_rotated_backward_cuda_kernel(
atomicAdd(offset_bottom_diff + y_high * width + x_low, g3);
atomicAdd(offset_bottom_diff + y_high * width + x_high, g4);
} // if
} // ix
} // iy
} // CUDA_1D_KERNEL_LOOP
} // ix
} // iy
} // CUDA_1D_KERNEL_LOOP
} // RoIAlignBackward

#endif // ROI_ALIGN_ROTATED_CUDA_KERNEL_CUH
2 changes: 1 addition & 1 deletion mmcv/ops/csrc/common/mlu/common_mlu_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define PAD_DOWN(x, y) (((x) / (y)) * (y))
#endif

#define CEIL_ALIGN(x, y) (((x) + (y)-1) / (y) * (y))
#define CEIL_ALIGN(x, y) (((x) + (y) - 1) / (y) * (y))

template <typename scalar_t>
__mlu_func__ inline scalar_t min(scalar_t a, scalar_t b) {
Expand Down
4 changes: 2 additions & 2 deletions mmcv/ops/csrc/common/pytorch_mlu_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

#define PAD_DOWN(x, y) (((x) / (y)) * (y))

#define CEIL_DIV(x, y) (((x) + (y)-1) / (y))
#define CEIL_DIV(x, y) (((x) + (y) - 1) / (y))

#define CEIL_ALIGN(x, y) (((x) + (y)-1) / (y) * (y))
#define CEIL_ALIGN(x, y) (((x) + (y) - 1) / (y) * (y))

inline int32_t getJobLimitCapability() {
CNcontext drv_ctx;
Expand Down
4 changes: 2 additions & 2 deletions mmcv/ops/csrc/common/pytorch_npu_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void ReleaseConvertTypes(Tuple &t) {
}

template <typename... Ts>
constexpr auto ConvertTypes(Ts &... args) {
constexpr auto ConvertTypes(Ts &...args) {
return std::make_tuple(ConvertType(args)...);
}

Expand Down Expand Up @@ -506,7 +506,7 @@ void AddParamToBuf(const string &);
void AddParamToBuf();

template <typename T, typename... Args>
void AddParamToBuf(const T &arg, Args &... args) {
void AddParamToBuf(const T &arg, Args &...args) {
AddParamToBuf(arg);
AddParamToBuf(args...);
}
Expand Down
Loading

0 comments on commit 96c4d7c

Please sign in to comment.