Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the typo uncoditional -> unconditional #249

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/conditional_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def parse_args():
'--save-path',
type=str,
default='./work_dirs/demos/conditional_samples.png',
help='path to save uncoditional samples')
help='path to save unconditional samples')
parser.add_argument(
'--device', type=str, default='cuda:0', help='CUDA device id')

Expand Down
2 changes: 1 addition & 1 deletion demo/ddpm_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def parse_args():
'--save-path',
type=str,
default='./work_dirs/demos/ddpm_samples.png',
help='path to save uncoditional samples')
help='path to save unconditional samples')
parser.add_argument(
'--device', type=str, default='cuda:0', help='CUDA device id')

Expand Down
10 changes: 5 additions & 5 deletions demo/unconditional_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# yapf: disable
sys.path.append(os.path.abspath(os.path.join(__file__, '../..'))) # isort:skip # noqa

from mmgen.apis import init_model, sample_uncoditional_model # isort:skip # noqa
from mmgen.apis import init_model, sample_unconditional_model # isort:skip # noqa
# yapf: enable


Expand All @@ -21,7 +21,7 @@ def parse_args():
'--save-path',
type=str,
default='./work_dirs/demos/unconditional_samples.png',
help='path to save uncoditional samples')
help='path to save unconditional samples')
parser.add_argument(
'--device', type=str, default='cuda:0', help='CUDA device id')

Expand Down Expand Up @@ -65,9 +65,9 @@ def main():
if args.sample_cfg is None:
args.sample_cfg = dict()

results = sample_uncoditional_model(model, args.num_samples,
args.num_batches, args.sample_model,
**args.sample_cfg)
results = sample_unconditional_model(model, args.num_samples,
args.num_batches, args.sample_model,
**args.sample_cfg)
results = (results[:, [2, 1, 0]] + 1.) / 2.

# save images
Expand Down
4 changes: 2 additions & 2 deletions docs/en/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ PYTHONPATH="$(dirname $0)/..":$PYTHONPATH
To verify whether MMGeneration and the required environment are installed correctly, we can run sample Python code to initialize an unconditional model and use it to generate random samples:

```python
from mmgen.apis import init_model, sample_uncoditional_model
from mmgen.apis import init_model, sample_unconditional_model

config_file = 'configs/styleganv2/stylegan2_c2_lsun-church_256_b4x8_800k.py'
# you can download this checkpoint in advance and use a local file path.
Expand All @@ -159,7 +159,7 @@ device = 'cuda:0'
# init a generatvie
model = init_model(config_file, checkpoint_file, device=device)
# sample images
fake_imgs = sample_uncoditional_model(model, 4)
fake_imgs = sample_unconditional_model(model, 4)
```

The above code is supposed to run successfully upon you finish the installation.
2 changes: 1 addition & 1 deletion docs/en/quick_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MMGeneration provides high-level APIs for sampling images with unconditional GAN

```python
import mmcv
from mmgen.apis import init_model, sample_uncoditional_model
from mmgen.apis import init_model, sample_unconditional_model

# Specify the path to model config and checkpoint file
config_file = 'configs/styleganv2/stylegan2_c2_ffhq_1024_b4x8.py'
Expand Down
4 changes: 2 additions & 2 deletions mmgen/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .inference import (init_model, sample_conditional_model,
sample_ddpm_model, sample_img2img_model,
sample_uncoditional_model)
sample_unconditional_model)
from .train import set_random_seed, train_model

__all__ = [
'set_random_seed', 'train_model', 'init_model', 'sample_img2img_model',
'sample_uncoditional_model', 'sample_conditional_model',
'sample_unconditional_model', 'sample_conditional_model',
'sample_ddpm_model'
]
10 changes: 5 additions & 5 deletions mmgen/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def init_model(config, checkpoint=None, device='cuda:0', cfg_options=None):


@torch.no_grad()
def sample_uncoditional_model(model,
num_samples=16,
num_batches=4,
sample_model='ema',
**kwargs):
def sample_unconditional_model(model,
num_samples=16,
num_batches=4,
sample_model='ema',
**kwargs):
"""Sampling from unconditional models.

Args:
Expand Down
2 changes: 1 addition & 1 deletion mmgen/datasets/grow_scale_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@DATASETS.register_module()
class GrowScaleImgDataset(Dataset):
"""Grow Scale Uncoditional Image Dataset.
"""Grow Scale Unconditional Image Dataset.

This dataset is similar with ``UnconditionalImageDataset``, but offer
more dynamic functionalities for the supporting complex algorithms, like
Expand Down
2 changes: 1 addition & 1 deletion mmgen/datasets/unconditional_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@DATASETS.register_module()
class UnconditionalImageDataset(Dataset):
"""Uncoditional Image Dataset.
"""Unconditional Image Dataset.

This dataset contains raw images for training unconditional GANs. Given
a root dir, we will recursively find all images in this root. The
Expand Down
10 changes: 5 additions & 5 deletions tests/test_apis/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import torch

from mmgen.apis import (init_model, sample_ddpm_model, sample_img2img_model,
sample_uncoditional_model)
sample_unconditional_model)


class TestSampleUnconditionalModel:
Expand All @@ -20,22 +20,22 @@ def setup_class(cls):
cls.model = init_model(config, checkpoint=None, device='cpu')

def test_sample_unconditional_model_cpu(self):
res = sample_uncoditional_model(
res = sample_unconditional_model(
self.model, 5, num_batches=2, sample_model='orig')
assert res.shape == (5, 3, 64, 64)

res = sample_uncoditional_model(
res = sample_unconditional_model(
self.model, 4, num_batches=2, sample_model='orig')
assert res.shape == (4, 3, 64, 64)

@pytest.mark.skipif(not torch.cuda.is_available(), reason='requires cuda')
def test_sample_unconditional_model_cuda(self):
model = self.model.cuda()
res = sample_uncoditional_model(
res = sample_unconditional_model(
model, 5, num_batches=2, sample_model='orig')
assert res.shape == (5, 3, 64, 64)

res = sample_uncoditional_model(
res = sample_unconditional_model(
model, 4, num_batches=2, sample_model='orig')
assert res.shape == (4, 3, 64, 64)

Expand Down