brycedrennan / imaginairy Goto Github PK
View Code? Open in Web Editor NEWPythonic AI generation of images and videos
License: MIT License
Pythonic AI generation of images and videos
License: MIT License
Hello,
I understand that --show-work can be used to get an image each time a step is accomplished (please correct me if I'm wrong).
When I add --show-work to the command line, the image generation fails
imagine "text" --precision full --fix-faces --steps 50 --show-work
imaginAIry received 1 prompt(s) and will repeat them 1 times to create 1 images.
Running in CPU mode. it's gonna be slooooooow.
Generating πΌ 1/1: "text" 512x512px seed:187796535 prompt-strength:7.5 steps:27 sampler-type:plms
Loading model /home/g/.cache/huggingface/transformers/d12e71b67e29abaf317bf9d0e31644872fd2072509a4b3582cbb0c30f70824e9.98fc1312797017a8bac6993df565908fd18f09319b40d9bd35457dfa1459ecf0 onto cpu backend...
Traceback (most recent call last):
File "/home/g/./.local/bin/imagine", line 8, in
sys.exit(imagine_cmd())
File "/home/g/.local/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/home/g/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/g/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/g/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/g/.local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/g/.local/lib/python3.10/site-packages/imaginairy/cmds.py", line 238, in imagine_cmd
imagine_image_files(
File "/home/g/.local/lib/python3.10/site-packages/imaginairy/api.py", line 74, in imagine_image_files
for result in imagine(
File "/home/g/.local/lib/python3.10/site-packages/imaginairy/api.py", line 246, in imagine
log_latent(init_latent_noised, "init_latent_noised")
File "/home/g/.local/lib/python3.10/site-packages/imaginairy/log_utils.py", line 28, in log_latent
_CURRENT_LOGGING_CONTEXT.log_latents(latents, description)
File "/home/g/.local/lib/python3.10/site-packages/imaginairy/log_utils.py", line 72, in log_latents
if latents.shape[1] != 4:
AttributeError: 'NoneType' object has no attribute 'shape'
Do you know why this issue ?
I am wondering if it could run a bit faster on M1 machine with latest PyTorch?
https://pytorch.org/blog/PyTorch-1.13-release
Also, "Loading mode" part seems to be slow and need to run each time, can this step also be skipped?
Hello,
how can i in commandline execution make that imaginairy use my RTX 2070 instead of my cpu ?
My graphics card is a NVIDIA GeForce GTX 1050 Ti, 4G memory.
When I run the imagine
command I receive this error:
File "/home/user1/.pyenv/versions/3.10.6/envs/imaginairy-3.10.6/lib/python3.10/site-packages/torch/nn/modules/module.py", line 925, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
RuntimeError: CUDA out of memory. Tried to allocate 58.00 MiB (GPU 0; 3.95 GiB total capacity; 2.82 GiB already allocated; 69.38 MiB free; 2.90 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.
See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
I didn't find a minimum requirements in project's README, so I am assuming a 4G GPU isn't enough to run this application. However I was able to run this stable diffusion project, so I am hoping some configuration could solve this for imaginAlry.
PLMS sampler fails with this error. This happens when an init image is smaller than the prompt size in both x and y.
I solved this by changing the pillow_fit_image_within()
function from:
def pillow_fit_image_within(image: PIL.Image.Image, max_height=512, max_width=512):
image = image.convert("RGB")
w, h = image.size
if w > max_width or h > max_height:
resize_ratio = min(max_width / w, max_height / h)
w, h = int(w * resize_ratio), int(h * resize_ratio)
w, h = map(lambda x: x - x % 64, (w, h)) # resize to integer multiple of 64
image = image.resize((w, h), resample=Image.Resampling.LANCZOS)
return image
to
def pillow_fit_image_within(image: PIL.Image.Image, max_height=512, max_width=512):
image = image.convert("RGB")
w, h = image.size
if w < max_width and h < max_height:
# image size is smaller than both prompt width and prompt height
resize_ratio = max(max_width / w, max_height / h)
w, h = int(w * resize_ratio), int(h * resize_ratio)
w, h = map(lambda x: x - x % 64, (w, h)) # resize to integer multiple of 64
image = image.resize((w, h), resample=Image.Resampling.LANCZOS)
elif w > max_width or h > max_height:
resize_ratio = min(max_width / w, max_height / h)
w, h = int(w * resize_ratio), int(h * resize_ratio)
w, h = map(lambda x: x - x % 64, (w, h)) # resize to integer multiple of 64
image = image.resize((w, h), resample=Image.Resampling.LANCZOS)
return image
in order to scale the image up to match the prompt size. I've only tested this with a couple of undersized images, but it seems to be working as intended so far. I'd submit a pull request, but my fork is messy.
After installation in a 3.10 virtualenv the imagine cli throws this error on first usage.
hdddrive/python/ai via v3.10.7 (ai) $ imagine 'a dog'
Traceback (most recent call last):
File "/usr/bin/imagine", line 5, in <module>
from deep_daze.cli import main
ModuleNotFoundError: No module named 'deep_daze'
hdddrive/python/ai via v3.10.7 (ai) $
Even after pip install deep_daze
the error persists
The most time-consuming step seems to be startup and loading the model. On my system (Ubuntu 20.04 in WSL on Windows 10, Ryzen 3600X, RTX 3080), startup takes about 11 seconds compared to about 3-4 seconds for the actual image generation (at 40 steps).
It would be nice to have a REPL-like mode where the script stays running and you can enter new prompts and options until you explicitly quit. This would speed up generating a bunch of different images a lot.
julien@pop7550:~$ imagine "a scenic landscape" "a photo of a dog" "photo of a fruit bowl" "portrait photo of a freckled woman"
π€π§ imaginAIry received 4 prompt(s) and will repeat them 1 times to create 4 images.
Running in CPU mode. it's gonna be slooooooow.
Generating πΌ 1/4: "a scenic landscape" 512x512px seed:913183355 prompt-strength:7.5 steps:40 sampler-type:plms
Loading model /home/julien/.cache/huggingface/transformers/d12e71b67e29abaf317bf9d0e31644872fd2072509a4b3582cbb0c30f70824e9.98fc1312797017a8bac6993df565908fd18f09319b40d9bd35457dfa1459ecf0 onto cpu backend...
0%| | 0/40 [00:04<?, ?it/s]
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
File "/home/julien/.local/bin/imagine", line 8, in <module>
sys.exit(imagine_cmd())
File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/cmds.py", line 238, in imagine_cmd
imagine_image_files(
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/api.py", line 74, in imagine_image_files
for result in imagine(
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/api.py", line 248, in imagine
samples = sampler.sample(
File "/home/julien/.local/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/samplers/plms.py", line 98, in sample
noisy_latent, predicted_latent, noise_pred = self.p_sample_plms(
File "/home/julien/.local/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/samplers/plms.py", line 139, in p_sample_plms
noise_pred = get_noise_prediction(
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/samplers/base.py", line 130, in get_noise_prediction
noise_pred_neutral, noise_pred_positive = denoise_func(
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/diffusion/ddpm.py", line 763, in apply_model
x_recon = self.model(x_noisy, t, **cond)
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/diffusion/ddpm.py", line 888, in forward
out = self.diffusion_model(x, t, context=cc)
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/diffusion/openaimodel.py", line 778, in forward
h = module(h, emb, context)
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/diffusion/openaimodel.py", line 85, in forward
x = layer(x, context)
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/attention.py", line 320, in forward
x = block(x, context=context)
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/attention.py", line 266, in forward
return checkpoint(
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/diffusion/util.py", line 150, in checkpoint
return CheckpointFunction.apply(func, len(inputs), *args)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/diffusion/util.py", line 163, in forward
output_tensors = ctx.run_function(*ctx.input_tensors)
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/modules/attention.py", line 272, in _forward
x = self.attn1(self.norm1(x)) + x
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/julien/.local/lib/python3.10/site-packages/torch/nn/modules/normalization.py", line 190, in forward
return F.layer_norm(
File "/home/julien/.local/lib/python3.10/site-packages/imaginairy/utils.py", line 102, in _fixed_layer_norm
return torch.layer_norm(
RuntimeError: expected scalar type BFloat16 but found Float
Hello,
First I wanted to thank you for the simplicity of the setup of this stable diffusion CLI.
Just tried it with a Nvidia GTX 1660 super with 6GB of RAM, but any prompt will output a red-ish image:
$ imagine "a photo of a dog"
edit: it may somehow be related to: Sygil-Dev/sygil-webui#34
Let me know if there is any details I could provide to help you :)
Thanks !
If I use DiffusionBee app, I can have result under 4 minutes, I wonder now if imaginAIry with it's beautiful text based Terminal command can also perform more or less in such speed?
What could be a way to run this faster?
I have created a model with Textual Inversion, and I was wondering if there can be an easy CLI option to select the model to generate from?
just setting up a brand new M1 mac out of box.. and as well as noted requirements, i.e.:
-homebrew
-python3/pip3
-rust
found that
sudo pip3 install setuptools-rust
was required for the pip installation of imaginairy to be able to do its 'rust things'..
BTW I previously had imaginairy running (and working!) on a 2015 i7 intel Macbook Pro.. granted it took 15 mins to do a 40 step 'imagine' but I thought that it worked at all was a minor miracle! :-)
>>> import imaginairy
/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: dlopen(/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/image.so, 0x0006): Symbol not found: __ZN3c106detail19maybe_wrap_dim_slowExxb
Referenced from: <8080486D-E510-3000-AA6A-F3AD49ACC172> /Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/image.so
Expected in: <8ADDD67A-2C07-3290-B140-DF1BD644AB8B> /Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torch/lib/libc10.dylib
warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/imaginairy/__init__.py", line 7, in <module>
from .api import imagine, imagine_image_files # noqa
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/imaginairy/api.py", line 16, in <module>
from imaginairy.enhancers.clip_masking import get_img_mask
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/imaginairy/enhancers/clip_masking.py", line 8, in <module>
from torchvision import transforms
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/__init__.py", line 7, in <module>
from torchvision import models
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/models/__init__.py", line 18, in <module>
from . import quantization
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/models/quantization/__init__.py", line 3, in <module>
from .mobilenet import *
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/models/quantization/mobilenet.py", line 1, in <module>
from .mobilenetv2 import * # noqa: F401, F403
File "/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torchvision/models/quantization/mobilenetv2.py", line 6, in <module>
from torch.ao.quantization import QuantStub, DeQuantStub
ImportError: cannot import name 'QuantStub' from 'torch.ao.quantization' (/Users/jimmygunawan/miniforge3/lib/python3.9/site-packages/torch/ao/quantization/__init__.py)
And during the pip installation of ImaginAIry it complains:
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
(base) jimmygunawan@192-168-1-114 ~ % pip3 install numpy
Collecting numpy
Using cached numpy-1.23.3-cp39-cp39-macosx_11_0_arm64.whl (13.4 MB)
Installing collected packages: numpy
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-macos 2.6.0 requires numpy~=1.19.2, but you have numpy 1.23.3 which is incompatible.
scipy 1.7.1 requires numpy<1.23.0,>=1.16.5, but you have numpy 1.23.3 which is incompatible.
Device 0 [NVIDIA GeForce GTX 1080] PCIe GEN 3@16x RX: 25.00 MB/s TX: 6.000 MB/s GPU 1898MHz MEM 4513MHz TEMP 72Β°C FAN 60% POW 189 / 200 W
miniforge3's ldm env, install from InvokeVI(lstein/stable-diffusion) Ubuntu .yml
Do 60 image generation at a time, args following:
imagine "xxxxxxx " \ --repeats 60 \ --steps 50 \ --prompt-strength 7.5 \ --sampler-type k_lms \ --width 512 \ --height 512 \ --fix-faces \ --upscale
It runs smoothly at first, very fast, producing a new image in about 20 seconds (For my GPU card), but after a while (usually a few minutes or so), it starts reporting errors. It looks like every iteration there are hundreds of megabytes of VRAM that are not freed up.
RuntimeError: CUDA out of memory. Tried to allocate 534.00 MiB (GPU 0; 7.93 GiB total capacity; 6.19 GiB already allocated; 528.81 MiB free; 6.79 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
I've tried the following , it maybe work.(We went from a dozen iterations to 30+)
`
def clean_memory():
if get_device() == 'cuda':
gc.collect()
torch.cuda.empty_cache()
ImaginePrompt.init()
...
self.tile_mode = tile_mode
clean_memory()
It'd be handy if auto generated filenames could consistently be 'split' on underscores, this is mostly the case, except, e.g.
imagine "cat in an art deco setting. photo realistic by {artist}" --sampler-type k_dpm_2
creates something like:
000155_458176395_k_dpm_240_PS7.5_cat_in_an_art_deco_setting.photo_realistic_by_saturno_butto[generated].jpg
where the sampler type itself has underscores (in this case k_dpm_2, but will be same for k_lms|k_dpm_2|k_dpm_2_a|k_euler|k_euler_a|k_heun) and therefore creates more items in a 'split' (compared to plain plms, ddim etc)..
maybe take underscores out of sampler names all together.. or.. just strip them out before creating filename?
Using pip install imaginairy==6.0.0a0
on MacBook Pro M1 Max
prompt, doesn't matter fails on any prompt: imagine "a scenic landscape in a watercolour style artstation"
/miniforge3/lib/python3.9/site-packages/imaginairy/vendored/k_diffusion/external.py", line 97, in t_to_sigma log_sigma = (1 - w) * self.log_sigmas[low_idx] + w * self.log_sigmas[high_idx]
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
Under Todo > Image Enhancement > image describe feature
in the Readme is an entry for "https://github.com/pharmapsychotic/clip-interrogator (blip + clip)"
The ability to pass an image and phrases to CLIP is already present as enhancers.describe_image_clip.find_img_text_similarity
. The ability to use BLIP is already marked as done on the Todo list. The only remaining part of the pharmapsychotic/clip-interrogator
code that is not implement here is the long lists of artists, mediums, etc..
There is a package on pypi called clip-gaze
that includes cleaned and expanded upon versions of those lists (as well as implementing a version of find_img_text_similarity
). It has no dependencies beyond what is already needed in this repo.
If the lists are desirable I suggest importing them from clip_gaze
, and if not then I think that part of the Todo can be checked off.
"just works" was not valid for me on my M1
With
brew install cmake protobuf rust
python3 -m venv env
. env/bin/activate
pip install imaginairy
I run into
creating None/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/tmpzh5sjcuo
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/hannes/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/hannes/miniforge3/include -arch arm64 -I/opt/homebrew/opt/openssl@3/include -I/Users/hannes/git/ai/imaginAIry/env/include -I/Users/hannes/miniforge3/include/python3.9 -c /var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/tmpzh5sjcuo/a.c -o None/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/tmpzh5sjcuo/a.o
Traceback (most recent call last):
File "/Users/hannes/miniforge3/lib/python3.9/distutils/unixccompiler.py", line 117, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
_classic_spawn(self, command)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/spawn.py", line 91, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/opt/homebrew/opt/llvm/bin/clang' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/commands.py", line 280, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Users/hannes/git/ai/imaginAIry/env/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 529, in build_extension
objects = self.compiler.compile(sources,
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/_parallel_compile_patch.py", line 58, in _parallel_compile
multiprocessing.pool.ThreadPool(BUILD_EXT_COMPILER_JOBS).map(
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/commands.py", line 263, in new_compile
return old_compile(obj, src, ext, cc_args, extra_postargs,
File "/Users/hannes/miniforge3/lib/python3.9/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command '/opt/homebrew/opt/llvm/bin/clang' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/setup.py", line 540, in <module>
setuptools.setup(
File "/Users/hannes/git/ai/imaginAIry/env/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/hannes/miniforge3/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/hannes/git/ai/imaginAIry/env/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/install.py", line 546, in run
self.run_command('build')
File "/Users/hannes/miniforge3/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/hannes/git/ai/imaginAIry/env/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/commands.py", line 284, in build_extensions
raise CommandError(
commands.CommandError: Failed `build_ext` step:
Traceback (most recent call last):
File "/Users/hannes/miniforge3/lib/python3.9/distutils/unixccompiler.py", line 117, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
_classic_spawn(self, command)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/spawn.py", line 91, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/opt/homebrew/opt/llvm/bin/clang' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/commands.py", line 280, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Users/hannes/git/ai/imaginAIry/env/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/Users/hannes/miniforge3/lib/python3.9/distutils/command/build_ext.py", line 529, in build_extension
objects = self.compiler.compile(sources,
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/_parallel_compile_patch.py", line 58, in _parallel_compile
multiprocessing.pool.ThreadPool(BUILD_EXT_COMPILER_JOBS).map(
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/hannes/miniforge3/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-install-bfttvlxs/grpcio_2e6589fc53b54149beaca903ff651a0d/src/python/grpcio/commands.py", line 263, in new_compile
return old_compile(obj, src, ext, cc_args, extra_postargs,
File "/Users/hannes/miniforge3/lib/python3.9/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command '/opt/homebrew/opt/llvm/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
Γ Encountered error while trying to install package.
β°β> grpcio
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Currently, the NSFW filter cannot be disabled if you're using the imagine
command (at least I haven't found how). Since mostly everyone wants the filter off, it would be good if the default were off and it had an option to enable it.
I see:
ImaginePrompt([
WeightedPrompt("cat", weight=1),
WeightedPrompt("dog", weight=1),
]),
in examples, by can't quite figure out a couple of things:
thanks in advance
I am getting this message :
CUDA error: no kernel image is available for execution on the device wsl2
thank you
https://github.com/bloc97/CrossAttentionControl/
By the looks of it, this technique seems more intuitive and easier for beginners to use to get the desired output from SD, compared to mask prompts/images with clipseg. I feel like it could fit in well with this project as the goal of both seem to be ease of use.
Is this something that sounds reasonable, or am I overestimating the usefulness of this technique?
I tried a bunch of workarounds but I always get this error if I install /run it in a conda environment:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)>
Works fine in my main environment. I think downloading the model from github requires SSL on requests.
if prompt.fix_faces:
logger.info(" Fixing π 's in πΌ using CodeFormer...")
img = enhance_faces(img, fidelity=0.2)
if prompt.upscale:
logger.info(" Upscaling πΌ using real-ESRGAN...")
upscaled_img = upscale_image(img)
if prompt.fix_faces:
logger.info(" Fixing π 's in big πΌ using CodeFormer...")
upscaled_img = enhance_faces(upscaled_img, fidelity=0.8)
The upscaled version has significantly more "washed out" features as a consequence, with much less detail than its original scale counterpart.
Upscaled image with fix_faces
:
It's particularly visible in the hair. Could it be an idea to move the upscaling to happen before the face fixing to avoid this?
if prompt.upscale:
logger.info(" Upscaling πΌ using real-ESRGAN...")
upscaled_img = upscale_image(img)
if prompt.fix_faces:
logger.info(" Fixing π 's in big πΌ using CodeFormer...")
upscaled_img = enhance_faces(upscaled_img, fidelity=0.8)
elif prompt.fix_faces:
logger.info(" Fixing π 's in πΌ using CodeFormer...")
img = enhance_faces(img, fidelity=0.2)
Or simply remove the enhance_faces() call for the upscaled img, or make it an optional flag?
Hey,
Thanks for repsonding to my previous issue!
I upgraded my imaginairy today to v1.1.4, and found the imagine command no longer worked. When i reduced the version to v1.1.2, it worked again.
HI Just thought I'd let you know I'm getting the same thing on PoP OS:
File "/home/jasper/anaconda3/lib/python3.9/site-packages/torch/nn/functional.py", line 2516, in group_norm return torch.group_norm(input, num_groups, weight, bias, eps, torch.backends.cudnn.enabled)RuntimeError: expected scalar type BFloat16 but found Float
https://www.reddit.com/r/StableDiffusion/comments/xdcgh0/comment/ip5m1hh/?context=3
thanks for #73!
when testing that I ran into a problem with k_dpm_fast - it seems to initialise at --steps XX +1?
e.g. imagine "an art deco cat" --sampler-type k_dpm_fast
will run an iteration with 41 steps, not 40
when this happens from #73 example script:
imagine_image_files(prompts, outdir="output")
it looses the plot entirely and just keeps iterating..
just another suggestion..
interesting testing with same prompt + seed with different sampler types led to a thought that having the option for 'each', or 'series' (ddim+plms), or 'random' options on --sampler-type might come in handy..
not sure what syntax would be consistent with command line options but maybe using {} or _option_
as per prompt syntaxes might work e.g.:
_each_
= do 1 each of sampler types available (currently 10, thereby creating ten images)
_random_
= choose 1 sampler randomly
'+ syntax' for 'series' thereby "--sampler-type ddim + plms + k_huen" = step through sampler series list thereby creating three images
or maybe [] easier to parse, e.g. --sampler-type [ddim plms k_huen]
not sure, leave as whether a sensible/useful idea, and implementation details, for you to decide :-)
-w 640 -h 896 and other larger-sized images seem to always trigger the safety filter no matter the prompt.
Hey!
Thank you so much for this resource, it's awesome!
I've come across an issue when i try to generate using the img2img functionality. I ran the command
imagine "painting of a dog surfing" --init-image "outputs/000001_528675053_plms40_PS7.5_a_dog_with_sunglasses_surfing_a_wave.jpg"
and I got this error
AttributeError: 'PLMSSampler' object has no attribute 'stochastic_encode'
I kept getting this error after also trying to use a seed, and changing number of steps.
OS: macOS 12.6
Hardware: MacBookPro M1 Pro
I get this error whenever I run the imagine command for Automated Replacement or Face Enhancement purpose:
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
Any idea? Thanks for this great tool!
(imaginairi) C:\Users\franc>imagine "A picture of an Icelandic landscape"
π€π§ imaginAIry received 1 prompt(s) and will repeat them 1 times to create 1 images.
Generating πΌ 1/1: "A picture of an Icelandic landscape" 512x512px seed:495117480 prompt-strength:7.5 steps:40 sampler-
type:plms
Loading model C:\Users\franc/.cache\huggingface\transformers\d12e71b67e29abaf317bf9d0e31644872fd2072509a4b3582cbb0c30f70824e9.98fc1312797017a8bac6993df565908fd18f09319b40d9bd35457dfa1459ecf0 onto cuda backend...
Traceback (most recent call last):
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\franc\anaconda3\envs\imaginairi\Scripts\imagine.exe\__main__.py", line 7, in <module>
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\imaginairy\cmds.py", line 238, in imagine_cmd
imagine_image_files(
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\imaginairy\api.py", line 74, in imagine_image_files
for result in imagine(
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\imaginairy\api.py", line 130, in imagine
model = get_diffusion_model(
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\imaginairy\model_manager.py", line 127, in get_diffusion_model
model.num_timesteps_cond # noqa
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\imaginairy\model_manager.py", line 50, in __getattr__
model = load_model_from_config(
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\imaginairy\model_manager.py", line 98, in load_model_from_config
model.to(get_device())
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\pytorch_lightning\core\mixins\device_dtype_mixin.py", line 109, in to
return super().to(*args, **kwargs)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\torch\nn\modules\module.py", line 987, in to
return self._apply(convert)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\torch\nn\modules\module.py", line 639, in _apply
module._apply(fn)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\torch\nn\modules\module.py", line 639, in _apply
module._apply(fn)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\torch\nn\modules\module.py", line 639, in _apply
module._apply(fn)
[Previous line repeated 4 more times]
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\torch\nn\modules\module.py", line 662, in _apply
param_applied = fn(param)
File "C:\Users\franc\anaconda3\envs\imaginairi\lib\site-packages\torch\nn\modules\module.py", line 985, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 4.00 GiB total capacity; 3.41 GiB already allocated; 0 bytes free; 3.46 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
(imaginairi) C:\Users\franc>
the example in readme:
imagine "a couple smiling" --steps 40 --seed 1 --fix-faces
now no longer yields results as shown unless changed to:
imagine "a couple smiling" --steps 40 --seed 1 --fix-faces --fix-faces-fidelity 0
so not sure if that's intended, or the default value for an unspecified --fix-face-fidelity is wrong, or not working?
Hello !
I've juste installed and started to use ImaginAIry on my laptop and I have a problem.
It seems to be stuck on CPU mode (every time I run it I get the "it's gonna be sloooooooow message").
How can I change that ? Thanks !
I'm running it in the windows Powershell, with a Nvidia GPU, for infos.
Hello!
I'm using imaginAIry version 4.1.0
installed via pip3. Python 3.10 from Homebrew. MacBook Pro 2021 M1, macOS 12.5. I had Python initially installed via asdf, but I had a problems with the SD, so I've reinstalled it from Homebrew.
When trying to use --fix-faces
, I'm getting this error
Traceback (most recent call last):
File "/opt/homebrew/bin/imagine", line 8, in <module>
sys.exit(imagine_cmd())
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/imaginairy/cmds.py", line 238, in imagine_cmd
imagine_image_files(
File "/opt/homebrew/lib/python3.10/site-packages/imaginairy/api.py", line 74, in imagine_image_files
for result in imagine(
File "/opt/homebrew/lib/python3.10/site-packages/imaginairy/api.py", line 294, in imagine
img = enhance_faces(img, fidelity=prompt.fix_faces_fidelity)
File "/opt/homebrew/lib/python3.10/site-packages/imaginairy/enhancers/face_restoration_codeformer.py", line 56, in enhance_faces
net = codeformer_model()
File "/opt/homebrew/lib/python3.10/site-packages/imaginairy/enhancers/face_restoration_codeformer.py", line 28, in codeformer_model
checkpoint = torch.load(ckpt_path)["params_ema"]
File "/opt/homebrew/lib/python3.10/site-packages/torch/serialization.py", line 777, in load
with _open_zipfile_reader(opened_file) as opened_zipfile:
File "/opt/homebrew/lib/python3.10/site-packages/torch/serialization.py", line 282, in __init__
super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
I've googled a bit and it seems that the problem with the Torch model (I'm not quite into that stuff so bear with me). Any ideas, where to look?
another minor suggestion..
with your new lists I'm sometimes using, say, {artist} with a -r 40 setting..
thus a 'where we're up to' included in progress outputs would be convenient..
something like:
Generating πΌ : "prompt"
becomes
Generating πΌ (x/40): "prompt"
or just on the end after, say, sampler-type:k_dpm_2, repeat:x/40
I realise that it might not be as simple as it looks due to way prompts + repeats can spawn many variations on the final image counts.. but thought I'd suggest anyway.
aimg describe outputs/000320_526397716_ddim40_PS7.5_ID_photo_of_a_child.jpg
FileNotFoundError: [Errno 2] No such file or directory: '/home/iwater/miniconda3/envs/imaginAIry/lib/python3.10/site-packages/imaginairy/vendored/blip/configs/med_config.json'
HI
I try to install imaginairy on GoogleCloud VM with GPU , debian 10.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Regards
Pierre
Currently when running pip install imaginairy
using Python 3.10.3.
I get this error:
Building wheel for grpcio (setup.py) ... error
...
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:165:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
double strtod(const char *, char **) __DARWIN_ALIAS(strtod);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:296:37:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h note: insert '_Nonnull' if the pointer should never be null
:165:35: note: insert '_Nullable' if the pointer may be null
char *devname_r(dev_t, mode_t, char *buf, int len);
^
_Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:296:6: double strtod(const char *, char **) __DARWIN_ALIAS(strtod);warning:
pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] ^
_Nullable
...
System Details
System Version: macOS 12.6 (21G115)
Model Name: MacBook Pro
Model Identifier: MacBookPro18,1
Chip: Apple M1 Pro
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 32 GB
System Firmware Version: 7459.141.1
OS Loader Version: 7459.141.1
When using this library programatically it can take a bit to load the model the first time, which makes it so that the first image generation takes significantly longer than subsequent ones. It would be nice if there was a way to preload models that you know you're going to be using so that this doesn't happen.
In general, I could generate 512 x 512 image using ImaginAIry, I love how easy the command line execution can run, with some functions.
However, I have been experiencing random crashing.
Also I noticed the "model loading" is also might be slowing down the process each time I run the command from Terminal.
[E thread_pool.cpp:113] Exception in thread pool task: mutex lock failed: Invalid argument
[E thread_pool.cpp:113] Exception in thread pool task: mutex lock failed: Invalid argument
[E thread_pool.cpp:113] Exception in thread pool task: mutex lock failed: Invalid argument
[E thread_pool.cpp:113] Exception in thread pool task: mutex lock failed: Invalid argument
[E thread_pool.cpp:113] Exception in thread pool task: mutex lock failed: Invalid argument
zsh: segmentation fault imagine "an old man carrying a chihuahua dog"
Image Generated. Timings: conditioning:0.51s sampling:272.66s safety-filter:4.32s total:290.51s
πΌ [generated] saved to: ./outputs/generated/000003_827498268_kdpmpp2m15_PS7.5_hawaiian_okinawa_pattern_[generated].jpg
Generating πΌ 3/3: "pile of nuts" 512x512px seed:898575060 prompt-strength:7.5 steps:15 sampler-type:k_dpmpp_2m
7%|ββββββββ | 1/15 [00:20<04:53, 20.97s/it]
Traceback (most recent call last):
File "/Users/blendersushi/miniconda3/bin/imagine", line 8, in <module>
sys.exit(imagine_cmd())
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/cmds.py", line 238, in imagine_cmd
imagine_image_files(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/api.py", line 74, in imagine_image_files
for result in imagine(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/api.py", line 308, in imagine
samples = sampler.sample(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/samplers/kdiff.py", line 117, in sample
samples = self.sampler_func(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/vendored/k_diffusion/sampling.py", line 735, in sample_dpmpp_2m
denoised = model(x, sigmas[i] * s_in, **extra_args)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/samplers/base.py", line 102, in forward
noise_pred = get_noise_prediction(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/samplers/base.py", line 150, in get_noise_prediction
noise_pred_neutral, noise_pred_positive = denoise_func(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/samplers/base.py", line 85, in _wrapper
return self.inner_model(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/vendored/k_diffusion/external.py", line 130, in forward
eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/vendored/k_diffusion/external.py", line 160, in get_eps
return self.inner_model.apply_model(*args, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/diffusion/ddpm.py", line 764, in apply_model
x_recon = self.model(x_noisy, t, **cond)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/diffusion/ddpm.py", line 889, in forward
out = self.diffusion_model(x, t, context=cc)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/diffusion/openaimodel.py", line 778, in forward
h = module(h, emb, context)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/diffusion/openaimodel.py", line 85, in forward
x = layer(x, context)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/attention.py", line 331, in forward
x = block(x, context=context)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/attention.py", line 277, in forward
return checkpoint(
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/diffusion/util.py", line 149, in checkpoint
return CheckpointFunction.apply(func, len(inputs), *args)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/diffusion/util.py", line 162, in forward
output_tensors = ctx.run_function(*ctx.input_tensors)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/attention.py", line 283, in _forward
x = self.attn1(self.norm1(x)) + x
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/attention.py", line 167, in forward
return self.forward_splitmem(x, context=context, mask=mask)
File "/Users/blendersushi/miniconda3/lib/python3.9/site-packages/imaginairy/modules/attention.py", line 224, in forward_splitmem
raise RuntimeError(
RuntimeError: Not enough memory, use lower resolution (max approx. 448x448). Need: 0.0GB free, Have:0.0GB free
so, did a, "pip install --upgrade imaginairy" to go up to v 2.3.0
now the following happens with no -fix-faces-fidelity supplied
(py-venv) shaun@Shauns-MBPro14 dev % imagine "a couple smiling" --steps 40 --seed 1 --fix-faces
π€π§ imaginAIry received 1 prompt(s) and will repeat them 1 times to create 1 images.
Loading model onto mps:0 backend...
Generating πΌ : "a couple smiling" 512x512px seed:1 prompt-strength:7.5 steps:40 sampler-type:plms
PLMS Sampler: 100%|βββββββββββββββββββββββββ| 40/40 [00:51<00:00, 1.29s/it]
Fixing π 's in πΌ using CodeFormer...
Enhancing 2 faces
Failed inference for CodeFormer: '>' not supported between instances of 'NoneType' and 'int'
Failed inference for CodeFormer: '>' not supported between instances of 'NoneType' and 'int'
πΌ [generated] saved to: ./outputs/generated/000015_1_plms40_PS7.5_a_couple_smiling_[generated].jpg
(py-venv) shaun@Shauns-MBPro14 dev %
adding --fix-faces-fidelity 0.2 suppresses these..
so not sure, type error in default?
When I force it to run on CPU it runs extremely slow. Sounds similar to what's described here:
don't think this is what you intended:
imagine "a {lime|blue|silver|aqua} colored dog" -r 2 --seed 0 will generate both "a red dog" and "a black dog"
typo eb = be
imagine "a {color} dog" -r 4 --seed 0 will generate four, different colored dogs. The colors will eb pulled from an included phraselist of colors.
Add heading for upgrade/update to point out the obvious for noobs (like me :-P).. i.e
Updating to latest version
use pip install --upgrade imaginairy
to update to latest version
While installing pip install imaginairy
on Mac (M1) it needs a dependency basicsr
, this will build from the source and fails: error: can't find Rust compiler
After installing rust on the recommended way and restarting the terminal it was able to install the package.
After successfully installing there was a runtime issue:
The protobuf
version 3.19.5
has an issue. need to downgrade / pin protobuf (pip install protobuf==3.19.4
)
Downloading,.... waiting for first image to appear⦠:)
I've been trying imaginary to swap clothes in photos (example mask is t-shirt), replace the mask with "yellow t shirt", but the results don't seem to work
Sometimes the mask isn't replaced at all, and sometimes it is replaced with something that doesn't match the prompt.
I've tried changing the prompt strength and init image strength, but can't seem to get what I want. Any suggestions on how I can tweak things to look like reasonable clothing replacements?
thought I'd mention this as a possible add to ref. links in docs because its generic enough to be useful to imaginairy users and I learnt a lot in just 100 slides or so..
https://openart.ai/promptbook
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.