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

Quick run[Docs] #2143

Open
FelixBellaby opened this issue Jun 2, 2024 · 0 comments
Open

Quick run[Docs] #2143

FelixBellaby opened this issue Jun 2, 2024 · 0 comments
Assignees
Labels
kind/doc fix, add or improve documentations

Comments

@FelixBellaby
Copy link

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')
@FelixBellaby FelixBellaby added the kind/doc fix, add or improve documentations label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/doc fix, add or improve documentations
Projects
None yet
Development

No branches or pull requests

2 participants