Skip to content

Commit

Permalink
[Fix] fix init_model and glide demo (#1888)
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-Fran authored Jun 2, 2023
1 parent 7f72bd6 commit 4c3ae9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion mmagic/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .inferencers.inference_functions import init_model
from .mmagic_inferencer import MMagicInferencer

__all__ = ['MMagicInferencer']
__all__ = ['MMagicInferencer', 'init_model']
14 changes: 7 additions & 7 deletions projects/glide/configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Diffusion models have recently been shown to generate high-quality synthetic ima

**Laion**

| Method | Resolution | Config | Weights |
| ------ | ---------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| Glide | 64x64 | [config](projects/glide/configs/glide_ddim-classifier-free_laion-64x64.py) | [model](https://download.openmmlab.com/mmediting/glide/glide_laion-64x64-02afff47.pth) |
| Glide | 64x64 -> 256x256 | [config](projects/glide/configs/glide_ddim-classifier-free_laion-64-256.py) | [model](https://download.openmmlab.com/mmediting/glide/glide_laion-64-256-02afff47.pth) |
| Method | Resolution | Config | Weights |
| ------ | ---------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| Glide | 64x64 | [config](projects/glide/configs/glide_ddim-classifier-free_laion-64x64.py) | [model](https://download.openmmlab.com/mmediting/glide/glide_laion-64x64-02afff47.pth) |
| Glide | 64x64 -> 256x256 | [config](projects/glide/configs/glide_ddim-classifier-free_laion-64-256.py) | [model](https://download.openxlab.org.cn/models/mmediting/GLIDE/weight/glide_laion-64-256) |

## Quick Start

Expand Down Expand Up @@ -72,14 +72,14 @@ You can synthesis images with 256x256 resolution:
```python
import torch
from torchvision.utils import save_image
from mmedit.apis import init_model
from mmagic.apis import init_model
from mmengine.registry import init_default_scope
from projects.glide.models import *

init_default_scope('mmedit')
init_default_scope('mmagic')

config = 'projects/glide/configs/glide_ddim-classifier-free_laion-64-256.py'
ckpt = 'https://download.openmmlab.com/mmediting/glide/glide_laion-64-256-02afff47.pth'
ckpt = 'https://download.openxlab.org.cn/models/mmediting/GLIDE/weight/glide_laion-64-256'
model = init_model(config, ckpt).cuda().eval()
prompt = "an oil painting of a corgi"

Expand Down

0 comments on commit 4c3ae9c

Please # to comment.