Skip to content

Commit

Permalink
Bump Version to mmagic v1.0.0
Browse files Browse the repository at this point in the history
Bump Version to mmagic v1.0.0
  • Loading branch information
Z-Fran authored Apr 25, 2023
2 parents a4f5950 + e5bb278 commit f672b21
Show file tree
Hide file tree
Showing 1,230 changed files with 7,896 additions and 8,175 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ workflows:
.github/.* lint_only true
demo/.* lint_only true
projects/.* lint_only true
mmedit/.* lint_only false
mmagic/.* lint_only false
requirements/.* lint_only false
tests/.* lint_only false
.circleci/.* lint_only false
Expand Down
24 changes: 12 additions & 12 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: Check docstring coverage
command: |
pip install interrogate
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 90 mmedit
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 90 mmagic
build_cpu:
parameters:
# The python version must match available image tags in
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
python -V
pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
- run:
name: Install mmediting dependencies
name: Install mmagic dependencies
command: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
Expand All @@ -70,7 +70,7 @@ jobs:
- run:
name: Run unittests
command: |
coverage run --branch --source mmedit -m pytest tests/
coverage run --branch --source mmagic -m pytest tests/
coverage xml
coverage report -m
build_cuda:
Expand All @@ -97,23 +97,23 @@ jobs:
- run:
name: Build Docker image
command: |
docker build .circleci/docker -t mmedit:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
docker run --gpus all -t -d -v /home/circleci/project:/mmedit -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -w /mmedit --name mmedit mmedit:gpu
docker build .circleci/docker -t mmagic:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
docker run --gpus all -t -d -v /home/circleci/project:/mmagic -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -w /mmagic --name mmagic mmagic:gpu
- run:
name: Install mmedit dependencies
name: Install mmagic dependencies
command: |
docker exec mmedit pip install -e /mmengine
docker exec mmedit pip install -U openmim
docker exec mmedit mim install 'mmcv >= 2.0.0'
docker exec mmedit pip install -r requirements/tests.txt
docker exec mmagic pip install -e /mmengine
docker exec mmagic pip install -U openmim
docker exec mmagic mim install 'mmcv >= 2.0.0'
docker exec mmagic pip install -r requirements/tests.txt
- run:
name: Build and install
command: |
docker exec mmedit pip install -e .
docker exec mmagic pip install -e .
- run:
name: Run unittests
command: |
docker exec mmedit pytest tests/
docker exec mmagic pytest tests/
workflows:
pr_stage_lint:
Expand Down
6 changes: 3 additions & 3 deletions .dev_scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Scripts for developing MMEditing
# Scripts for developing MMagic

- [1. Check UT](#1-check-ut)
- [2. Test all the models](#2-test-all-the-models)
Expand All @@ -20,7 +20,7 @@
Please check your UT by the following scripts:

```python
cd mmediting/
cd mmagic/
python .dev_script/update_ut.py
```

Expand All @@ -29,7 +29,7 @@ Please create UTs according to your package code implementation.

## 2. Test all the models

Please follow these steps to test all the models in MMEditing:
Please follow these steps to test all the models in MMagic:

First, you will need download all the pre-trained checkpoints by:

Expand Down
16 changes: 7 additions & 9 deletions .dev_scripts/create_ceph_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def update_ceph_config(filename, args, dry_run=False):
if hasattr(config, 'vis_backends'):
# TODO: support upload to ceph
# for vis_cfg in config['vis_backends']:
# if vis_cfg['type'] == 'GenVisBackend':
# if vis_cfg['type'] == 'VisBackend':
# vis_cfg['ceph_path'] = work_dir

# add pavi config
Expand All @@ -198,17 +198,15 @@ def update_ceph_config(filename, args, dry_run=False):
# check if pavi config is inheritance from _base_
find_inherit = False
for vis_cfg in config['vis_backends']:
if vis_cfg['type'] == 'PaviGenVisBackend':
if vis_cfg['type'] == 'PaviVisBackend':
vis_cfg['exp_name'] = name
vis_cfg['project'] = project
find_inherit = True
break

if not find_inherit:
pavi_cfg = dict(
type='PaviGenVisBackend',
exp_name=name,
project=project)
type='PaviVisBackend', exp_name=name, project=project)
config['vis_backends'].append(pavi_cfg)

# add wandb config
Expand All @@ -218,28 +216,28 @@ def update_ceph_config(filename, args, dry_run=False):
# check if wandb config is inheritance from _base_
find_inherit = False
for vis_cfg in config['vis_backends']:
if vis_cfg['type'] == 'WandbGenVisBackend':
if vis_cfg['type'] == 'WandbVisBackend':
vis_cfg['name'] = name # name of config
vis_cfg['project'] = project # name of model
find_inherit = True
break

if not find_inherit:
pavi_cfg = dict(
type='WandbGenVisBackend',
type='WandbVisBackend',
init_kwargs=dict(name=name, project=project))
config['vis_backends'].append(pavi_cfg)

# add tensorboard config
if args.add_tensorboard:
find_inherit = False
for vis_cfg in config['vis_backends']:
if vis_cfg['type'] == 'TensorboardGenVisBackend':
if vis_cfg['type'] == 'TensorboardVisBackend':
find_inherit = True
break

if not find_inherit:
tensorboard_cfg = dict(type='TensorboardGenVisBackend')
tensorboard_cfg = dict(type='TensorboardVisBackend')
config['vis_backends'].append(tensorboard_cfg)

config['visualizer']['vis_backends'] = config['vis_backends']
Expand Down
6 changes: 3 additions & 3 deletions .dev_scripts/download_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

from modelindex import load

MMEditing_ROOT = Path(__file__).absolute().parent.parent
DOWNLOAD_DIR = osp.join(MMEditing_ROOT, 'work_dirs', 'download')
MMagic_ROOT = Path(__file__).absolute().parent.parent
DOWNLOAD_DIR = osp.join(MMagic_ROOT, 'work_dirs', 'download')
IS_WINDOWS = (platform.system() == 'Windows')


Expand Down Expand Up @@ -69,7 +69,7 @@ def parse_args():


def download(args):
model_index_file = MMEditing_ROOT / 'model-index.yml'
model_index_file = MMagic_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
Expand Down
14 changes: 7 additions & 7 deletions .dev_scripts/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from task_mapping import TASK_MAPPING

console = Console()
MMEDITING_ROOT = Path(__file__).absolute().parents[1]
MMagic_ROOT = Path(__file__).absolute().parents[1]


def parse_args():
Expand Down Expand Up @@ -82,10 +82,10 @@ def parse_args():


def create_test_job_batch(commands, model_info, args, port, script_name):
config_http_prefix_blob = ('https://github.com/open-mmlab/mmediting/'
'blob/master/')
config_http_prefix_tree = ('https://github.com/open-mmlab/mmediting/'
'tree/master/')
config_http_prefix_blob = ('https://github.com/open-mmlab/mmagic/'
'blob/main/')
config_http_prefix_tree = ('https://github.com/open-mmlab/mmagic/'
'tree/main/')
fname = model_info.name

config = model_info.config
Expand Down Expand Up @@ -184,7 +184,7 @@ def create_test_job_batch(commands, model_info, args, port, script_name):

def test(args):
# parse model-index.yml
model_index_file = MMEDITING_ROOT / 'model-index.yml'
model_index_file = MMagic_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
Expand Down Expand Up @@ -346,7 +346,7 @@ def set_color(value, expect, tolerance, rule):


def summary(args):
model_index_file = MMEDITING_ROOT / 'model-index.yml'
model_index_file = MMagic_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
Expand Down
2 changes: 1 addition & 1 deletion .dev_scripts/test_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ cluster_num: '2'
default_floating_range: 1.0
model_floating_ranges: {}
partition: mm_lol
repo: mmediting
repo: mmagic
branch: dev-1.x
task_type: test
third_part_libs: []
14 changes: 7 additions & 7 deletions .dev_scripts/train_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from utils import filter_jobs, parse_job_list_from_file

console = Console()
MMEDIT_ROOT = Path(__file__).absolute().parents[1]
MMAGIC_ROOT = Path(__file__).absolute().parents[1]

# key-in-metafile: key-in-results.pkl
METRICS_MAP = {
Expand Down Expand Up @@ -176,10 +176,10 @@ def parse_args():


def create_train_job_batch(commands, model_info, args, port, script_name):
config_http_prefix_blob = ('https://github.com/open-mmlab/mmediting/'
'blob/master/')
config_http_prefix_tree = ('https://github.com/open-mmlab/mmediting/'
'tree/master/')
config_http_prefix_blob = ('https://github.com/open-mmlab/mmagic/'
'blob/main/')
config_http_prefix_tree = ('https://github.com/open-mmlab/mmagic/'
'tree/main/')
fname = model_info.name

config = model_info.config
Expand Down Expand Up @@ -281,7 +281,7 @@ def create_train_job_batch(commands, model_info, args, port, script_name):

def train(args):
# parse model-index.yml
model_index_file = MMEDIT_ROOT / 'model-index.yml'
model_index_file = MMAGIC_ROOT / 'model-index.yml'

model_index = load(str(model_index_file))
model_index.build_models_with_collections()
Expand Down Expand Up @@ -418,7 +418,7 @@ def set_color(value, expect, tolerance, rule):


def summary(args):
model_index_file = MMEDIT_ROOT / 'model-index.yml'
model_index_file = MMAGIC_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
Expand Down
2 changes: 1 addition & 1 deletion .dev_scripts/train_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ cluster_num: '2'
default_floating_range: 1.0
model_floating_ranges: {}
partition: mm_lol
repo: mmediting
repo: mmagic
branch: dev-1.x
task_type: train
third_part_libs: []
6 changes: 3 additions & 3 deletions .dev_scripts/update_config_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re
import sys

MMEditing_ROOT = osp.dirname(osp.dirname(osp.dirname(__file__)))
MMagic_ROOT = osp.dirname(osp.dirname(osp.dirname(__file__)))


def update_md(md_file):
Expand All @@ -20,7 +20,7 @@ def update_md(md_file):
Returns:
Bool: If the target README.md file is different from the original.
"""
# See https://github.com/open-mmlab/mmediting/pull/798 for these comments
# See https://github.com/open-mmlab/mmagic/pull/798 for these comments
# unique_dict = generate_unique_name(md_file)

md_file = md_file.replace(os.sep, '/')
Expand Down Expand Up @@ -63,7 +63,7 @@ def update_md(md_file):

if __name__ == '__main__':
if len(sys.argv) <= 1:
configs_root = osp.join(MMEditing_ROOT, 'configs')
configs_root = osp.join(MMagic_ROOT, 'configs')
file_list = glob.glob(
osp.join(configs_root, '**', '*README.md'), recursive=True)
file_list.sort()
Expand Down
14 changes: 7 additions & 7 deletions .dev_scripts/update_model_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
- `Version` (str): required
- `Image` (str): optional
The README.md file in MMEditing follows following convention,
The README.md file in MMagic follows following convention,
- `Model`: [name_in_the_paper](path_to_config)
- `Download`: [model](url_to_pre_trained_weights) | [log](url_to_log)
"""
Expand All @@ -90,7 +90,7 @@
from utils import (collate_metrics, dump_yaml_and_check_difference,
found_table, modelindex_to_dict)

MMEditing_ROOT = osp.dirname(osp.dirname(__file__))
MMagic_ROOT = osp.dirname(osp.dirname(__file__))
KEYWORDS = [
'Model',
'Dataset',
Expand All @@ -106,7 +106,7 @@ def parse_md(md_file):
Returns:
Bool: If the target YAML file is different from the original.
"""
readme = osp.relpath(md_file, MMEditing_ROOT)
readme = osp.relpath(md_file, MMagic_ROOT)
readme = readme.replace('\\', '/') # for windows
collection = Collection()
collection_meta = Metadata()
Expand Down Expand Up @@ -232,18 +232,18 @@ def update_model_index():
Returns:
Bool: If the updated model-index.yml is different from the original.
"""
configs_dir = osp.join(MMEditing_ROOT, 'configs')
configs_dir = osp.join(MMagic_ROOT, 'configs')
yml_files = glob.glob(osp.join(configs_dir, '**', '*.yml'), recursive=True)
yml_files.sort()

model_index = {
'Import': [
osp.relpath(yml_file, MMEditing_ROOT).replace(
osp.relpath(yml_file, MMagic_ROOT).replace(
'\\', '/') # force using / as path separators
for yml_file in yml_files
]
}
model_index_file = osp.join(MMEditing_ROOT, 'model-index.yml')
model_index_file = osp.join(MMagic_ROOT, 'model-index.yml')
is_different = dump_yaml_and_check_difference(model_index,
model_index_file)

Expand All @@ -252,7 +252,7 @@ def update_model_index():

if __name__ == '__main__':
if len(sys.argv) <= 1:
configs_root = osp.join(MMEditing_ROOT, 'configs')
configs_root = osp.join(MMagic_ROOT, 'configs')
file_list = glob.glob(
osp.join(configs_root, '**', '*README.md'), recursive=True)
file_list.sort()
Expand Down
8 changes: 4 additions & 4 deletions .dev_scripts/update_ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from tqdm import tqdm

parser = ArgumentParser()
parser.add_argument('--src', type=str, default='mmedit')
parser.add_argument('--src', type=str, default='mmagic')
parser.add_argument('--dst', type=str, default='tests')
parser.add_argument(
'--exclude',
nargs='+',
default=[
'mmedit/.mim', 'mmedit/registry.py', 'mmedit/version.py',
'mmagic/.mim', 'mmagic/registry.py', 'mmagic/version.py',
'__pycache__', '__init__', '**/__init__.py', '**/stylegan3_ops/*',
'**/conv2d_gradfix.py', '**/grid_sample_gradfix.py', '**/misc.py',
'**/upfirdn2d.py', '**/all_gather_layer.py', '**/typing.py'
Expand All @@ -34,7 +34,7 @@ def update_ut():
missing_ut = []
blank_ut = []

file_list = glob('mmedit/**/*.py', recursive=True)
file_list = glob('mmagic/**/*.py', recursive=True)

for f in tqdm(file_list):
if check_exclude(f):
Expand All @@ -44,7 +44,7 @@ def update_ut():

dirname = osp.dirname(f)
dirname = dirname.replace('__', '')
dirname = dirname.replace('mmedit', 'tests')
dirname = dirname.replace('mmagic', 'tests')
dirname = dirname.replace('/', '/test_')
os.makedirs(dirname, exist_ok=True)

Expand Down
Loading

0 comments on commit f672b21

Please sign in to comment.