brycedrennan / imaginAIry

Pythonic AI generation of images and videos
MIT License
7.94k stars 441 forks source link

aimg upscale with --model #351

Open xzitlou opened 1 year ago

xzitlou commented 1 year ago

Hi, is there a way to use the upscale feature with another model? I tried:

aimg upscale "test.jpeg" --fix-faces --outdir "/results/" --model openjourney-v4
...
Error: No such option: --model Did you mean --help?
brycedrennan commented 10 months ago

upscale doesn't use stable diffusion, it uses realesrgan. I would like to support other super-resolution algorithms in the future though.

brycedrennan commented 10 months ago

Using a stable diffusion model to upscale can be done via tile/details controlnet. I'll leave this open so we can make it easy to do that using the upscale command.

xzitlou commented 10 months ago

Thanks @brycedrennan for your help, sorry for being so bothersome, but do you have an example of how to use it with the mentioned configuration? Thanks.

brycedrennan commented 10 months ago

If you're just wanting to make big generations then the current master branch (unreleased) will work very well now.
imagine blueberries --size 1080p --upscale will produce a well-composed 8k image. The stable diffusion upscaling happens automatically to get the image to 1080p and then the upscale flag takes it to 8k.

To upscale an existing image... let me see. I'll try a few things and get back to you in a minute.

Love to see all the sites you've made with the tool. Would love to learn more about your setup. Reach out on discord sometime. 025580_1_ddim50_PS7 5_blueberries_ upscaled

brycedrennan commented 10 months ago

imagine --init-image tests/data/dog.jpg --control-mode details --init-image-strength 0.5 --size 2048 "a dog" --no-compose-phase --upscale Dog@512 dog

Dog@8192 025649_231460608_ddim50_PS7 5_img2img-0 5_a_dog_ upscaled

xzitlou commented 10 months ago

@brycedrennan quick question, what is the model you use in this command?

# generate kitchen remodel ideas
🤖🧠> imagine --control-image kitchen.jpg -w 1024 -h 1024 "{_interior-style_} kitchen" --control-mode depth -r 100 --init-image 0.01 --upscale --steps 35 --caption-text "{prompt}"
brycedrennan commented 10 months ago

since no model is specified the default models are used:

xzitlou commented 10 months ago

Thanks for your response, can specify a model like openjourney or the other availables?

brycedrennan commented 10 months ago

yep specify whatever model you want for the base model. --model

You should get much better looking results for large images from the currently unreleased version but the api has changed somewhat.

xzitlou commented 10 months ago

Awesome! Thanks @brycedrennan

bluusun commented 9 months ago

aimg upscale /root/work/*.jpg

has been working tremendously in former versions.

14.0.1 produces this:

Traceback (most recent call last): File "/usr/local/bin/aimg", line 6, in imaginairy.cli.main.aimg() File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click_shell/core.py", line 164, in invoke ret = super(Shell, self).invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/usr/local/lib/python3.10/site-packages/imaginairy/cli/upscale.py", line 34, in upscale_cmd from imaginairy.enhancers.face_restoration_codeformer import enhance_faces File "/usr/local/lib/python3.10/site-packages/imaginairy/enhancers/face_restoration_codeformer.py", line 12, in from imaginairy.utils.model_manager import get_cached_url_path File "/usr/local/lib/python3.10/site-packages/imaginairy/utils/model_manager.py", line 24, in from imaginairy.modules.refiners_sd import SDXLAutoencoderSliced, StableDiffusion_XL File "/usr/local/lib/python3.10/site-packages/imaginairy/modules/refiners_sd.py", line 12, in import imaginairy.vendored.refiners.fluxion.layers as fl ModuleNotFoundError: No module named 'imaginairy.vendored.refiners'

brycedrennan commented 9 months ago

that's no good! Sounds like something is pretty wrong. I'll fix tonight.

brycedrennan commented 9 months ago

Yeah a bunch of files were missing from the package. I've added them back and more importantly added a test so this doesn't happen again. 14.0.3 is working. @bluusun

bluusun commented 9 months ago

Awesome thanks! Will check. Will wait to make newest version productive for a bit.

bluusun commented 8 months ago

aimg version 14.1.1

aimg uspcale Usage: aimg [OPTIONS] COMMAND [ARGS]... Try 'aimg --help' for help.

Error: No such command 'uspcale'.

aimg uspcale /root/work

Usage: aimg [OPTIONS] COMMAND [ARGS]...

🤖🧠 ImaginAIry.

Pythonic generation of images via AI

Options: --help Show this message and exit.

Commands: colorize Colorize images using AI. describe Generate text descriptions of images. edit Edit an image via AI. edit-demo Make some fun pre-set edits to input photos. imagine Generate images via AI. model-list Print list of available models. server Run a HTTP API server. system-info Display system information. upscale Upscale an image 4x using AI. version Print the version. videogen AI generate a video from an image

What am I missing?

brycedrennan commented 8 months ago

uspcale

upscale

bluusun commented 8 months ago

OMG :)