Skip to content

Commit

Permalink
Merge pull request #3 from openxrlab/add_linting_workflow
Browse files Browse the repository at this point in the history
[New] setup pre-commit
  • Loading branch information
lisiyao21 authored Sep 1, 2022
2 parents 5357561 + 11ae52c commit a07fb94
Show file tree
Hide file tree
Showing 70 changed files with 1,888 additions and 1,512 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build

on:
push:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'README_CN.md'
- 'docs/**'

pull_request:
paths-ignore:
- 'README.md'
- 'README_CN.md'
- 'docs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_test:
runs-on: ubuntu-18.04
Expand All @@ -39,14 +39,14 @@ jobs:
# pip install torch numpy mmcv -i https://pypi.tuna.tsinghua.edu.cn/simple
# pip install opencv-python>=3 yapf imageio scikit-image -i https://pypi.tuna.tsinghua.edu.cn/simple
# coverage run --source xrmogen/models -m pytest -s test/models
# coverage run --source xrmogen/models -m pytest -s test/models
# coverage xml
# coverage report -m
- name: Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
fail_ci_if_error: false
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
sudo apt-add-repository ppa:brightbox/ruby-ng -y
sudo apt-get update
sudo apt-get install -y ruby2.7
# pip install pre-commit
# pre-commit install
pip install pre-commit
pre-commit install
- name: Linting
# run: pre-commit run --files xrmogen/*
run: pre-commit run --all-files
- name: Check docstring coverage
run: |
pip install interrogate
# interrogate -vinmMI --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" -f 60 xrmogen/
interrogate -vinmMI --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" -f 25 xrmogen/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ xrmogen.egg-info
*.whl
*ignore/
example/
data/
data/
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
repos:
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.3
hooks:
- id: flake8
- repo: https://github.com/asottile/seed-isort-config.git
rev: v2.2.0
hooks:
- id: seed-isort-config
args: [--settings-path, ./]
- repo: https://github.com/PyCQA/isort.git
rev: 5.10.1
hooks:
- id: isort
args: [--settings-file, ./setup.cfg]
- repo: https://github.com/pre-commit/mirrors-yapf.git
rev: v0.30.0
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.1.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: .*/tests/data/
- id: check-yaml
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: ["--ignore-words-list", "ba"]
- repo: https://github.com/myint/docformatter.git
rev: v1.3.1
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ RUN . /root/miniconda3/etc/profile.d/conda.sh && \
pip install tqdm && \
pip install xrprimer && \
pip install -e . && \
pip cache purge
pip cache purge
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The model structure can be customized through config files. To implement a new m

- `train_step()`: forward method of the training mode.
- `val_step()`: forward method of the testing mode.
- regestered as a dance model
- registered as a dance model


To be specific, if we want to implement a new model, there are several things to do.
Expand All @@ -79,7 +79,7 @@ To be specific, if we want to implement a new model, there are several things to

def __init__(self, model_config):
super().__init__()

def forward(self, ...):
....

Expand Down Expand Up @@ -113,7 +113,7 @@ To be specific, if we want to implement a new model, there are several things to

XRMoGen uses `mmcv.runner.EpochBasedRunner` to control training and test.

In the training mode, the `max_epochs` in config file decide how many epochs to train.
In the training mode, the `max_epochs` in config file decide how many epochs to train.
In test mode, `max_epochs` is forced to change to 1, which represents only 1 epoch to test.

Validation frequency is set as `workflow` of config file:
Expand All @@ -125,7 +125,7 @@ Validation frequency is set as `workflow` of config file:
For example, to train Bailando (Dance Revolution),

```shell
python main.py --config configs/dance_rev.py
python main.py --config configs/dance_rev.py
```

Arguments are:
Expand All @@ -134,7 +134,7 @@ Arguments are:

### Test
To test relevant model, add `--test_only` tag after the config path.
We provide some pretrained weights to test (see [pretrained_model_list.md](docs/en/pretrained_model_list.md). Download the pretrained weights under a folder `./example`, and run
We provide some pretrained weights to test (see [pretrained_model_list.md](docs/en/pretrained_model_list.md). Download the pretrained weights under a folder `./example`, and run

```shell
python main.py --config configs/bailando_test.py --test_only
Expand Down Expand Up @@ -201,4 +201,3 @@ We wish that the framework and benchmark could serve the growing research commun
- [XRMoCap](https://github.com/openxrlab/xrmocap): OpenXRLab Multi-view Motion Capture Toolbox and Benchmark.
- [XRMoGen](https://github.com/openxrlab/xrmogen): OpenXRLab Human Motion Generation Toolbox and Benchmark.
- [XRNeRF](https://github.com/openxrlab/xrnerf): OpenXRLab Neural Radiance Field (NeRF) Toolbox and Benchmark.

6 changes: 2 additions & 4 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ xrmogen

def __init__(self, model_config):
super().__init__()

def forward(self, ...):
....

Expand Down Expand Up @@ -124,7 +124,7 @@ XRMoGen 使用 `mmcv.runner.EpochBasedRunner` (以epoch为单位)去训练
比如,为了训练DanceRevolution模型,运行以下命令

```shell
python main.py --config configs/dance_rev.py
python main.py --config configs/dance_rev.py
```

参数:
Expand Down Expand Up @@ -189,5 +189,3 @@ XRMoGen 是一款由学校和公司共同贡献的开源项目。我们感谢所
- [XRMoCap](https://github.com/openxrlab/xrmocap): OpenXRLab Multi-view Motion Capture Toolbox and Benchmark.
- [XRMoGen](https://github.com/openxrlab/xrmogen): OpenXRLab Human Motion Generation Toolbox and Benchmark.
- [XRNeRF](https://github.com/openxrlab/xrnerf): OpenXRLab Neural Radiance Field (NeRF) Toolbox and Benchmark.


Loading

0 comments on commit a07fb94

Please sign in to comment.