Skip to content

Quick run[Docs]  #2143

@FelixBellaby

Description

@FelixBellaby

Branch

main branch https://mmagic.readthedocs.io/en/latest/

📚 The doc issue

The examples on the 'Quick run' introduction have to be run from the base of the git tree after installation. It would be better to use portable examples that test the installation tree.

Suggest a potential alternative/fix

This example does not rely on the existence of an 'output/' directory:

from mmagic.apis import MMagicInferencer
sd_inferencer = MMagicInferencer(model_name='stable_diffusion')
text_prompts = 'A panda is having dinner at KFC'
sd_inferencer.infer(text=text_prompts, result_out_dir='KFC_panda.png')

This example uses the previously created image and finds the config by name from the installation tree rather than digging the config source file out of the git tree:

from mmagic.apis import MMagicInferencer
checkpoint = 'https://download.openmmlab.com/mmediting/restorers/esrgan/esrgan_x4c64b23g32_1x16_400k_div2k_20200508-f8ccaf3b.pth'
editor = MMagicInferencer(model_name='esrgan', config_name='esrgan_x4c64b23g32_1xb16-400k_div2k', model_ckpt=checkpoint)
output = editor.infer(img='KFC_panda.png', result_out_dir='KFC_panda_hires.png')

Metadata

Metadata

Assignees

Labels

kind/docfix, add or improve documentations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions