From 42a9d84853092c0fb3970a085ea1ebda0e20c602 Mon Sep 17 00:00:00 2001 From: Z-Fran <1396925302@qq.com> Date: Fri, 2 Jun 2023 13:10:10 +0800 Subject: [PATCH] [Fix] fix init_model and glide demo --- mmagic/apis/__init__.py | 3 ++- projects/glide/configs/README.md | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mmagic/apis/__init__.py b/mmagic/apis/__init__.py index e99723a4bd..5020f3e494 100644 --- a/mmagic/apis/__init__.py +++ b/mmagic/apis/__init__.py @@ -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'] diff --git a/projects/glide/configs/README.md b/projects/glide/configs/README.md index 0d7e4e3ca6..3ac3fcce31 100644 --- a/projects/glide/configs/README.md +++ b/projects/glide/configs/README.md @@ -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 @@ -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"