1098 points · by bryced · 3y ago · 227 comments
Here are some examples of transformations it can make: Golden gate bridge: https://raw.githubusercontent.com/brycedrennan/imaginAIry/ma... Girl with a pearl earring: https://raw.githubusercontent.com/brycedrennan/imaginAIry/ma...
I integrated this new InstructPix2Pix model into imaginAIry (python library) so it's easy to use for python developers.
Apparently without prism glasses my vision just switches from one eye to the next every 30 seconds. Completely seamlessly.
`aimg edit assets/girl_with_a_pearl_earring.jpg "make it pop" --prompt-strength 40 --gif`
https://user-images.githubusercontent.com/1217531/213912442-...
https://www.youtube.com/watch?v=GOwi3x92teo
;)
[0]: https://www.drbronner.com/products/peppermint-pure-castile-l...
"Add lens flare"
"Increase saturation"
"Add sparkles and gleam"
>> aimg edit input.jpg "make it pop" --prompt-strength 25
Edit: Just noticed it is the same thing but wrapped, nevermind, pretty cool project!
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 2.9.2 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.3 which is incompatible. tensorboard 2.9.1 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.3 which is incompatible.
---
First time I've used "colab" - looks great. Out of interest, who pays for the compute used by this?
Is it freely offerred by Google? Or is it charged to my Google API account when I use it? Or your account? It wasn't clear in the UI.
But yeah sometimes it doesn't follow directions well. I haven't noticed a pattern yet for why that is.
‘Decrease high-frequency features of background.’
‘Increase intra-contrast of middle ground to foreground.’
‘Increase global saturation contrast.’
‘Increase hue spread of greens.’
Hopefully in a couple of years when things have matured more there will be more models capable of handling said requests
The most precise models are actually anime models because the users have got high standards for telling the machine what they expect of it and the databases are quite well annotated (booru tags)
To handle them all you would need a larger sample.
I want to be productive on this comment… but the crypto/cuda nexus of GPU work is simply not rational. Why are we still here?
You want to work in this field? Step 1. Buy an NVIDIA gpu. Step 2. CUDA. Step 3. Haha good luck, not available to purchase.
This situation is so crazy. My crappiest computer is way better at AI, just because I did an intel/nvidia build.
I don’t hate NVIDIA for innovating. The stagnation and risk of monopoly setting us back for unnecessary generations makes me a bit miffed.
So. To attempt to be productive here, what am I not seeing?
Because nvidia spent a long time chasing the market and spending resources, like they wanted it.
You wanted to learn about GPU compute in 2012? Here's a free udacity course sponsored by nvidia, complete with an online runtime backed by cloud GPUs so you can run the exercises straight from your browser.
You're building a deep learning framework? Here's a free library of accelerated primitives, and a developer who'll integrate it into your open source framework and update it as needed.
OpenCL, in contrast, behaves as if every member of the consortium is hoping some other member will bear these costs - as if they don't really want to be in the GPU compute business, except out of a begrudging need for feature parity.
And in terms of being rational - if you're skilled enough to be able to add support for a new GPU vendor into an ML library, you're probably paid enough that the price of a midrange nvidia GPU is trivial in comparison.
All is not lost, though - vendors like Intel are increasingly offering ML acceleration libraries [1] and most neural networks can be exported from one framework and imported into another.
[1] https://www.intel.com/content/www/us/en/developer/tools/onea...
Also the vast majority of ML researchers and engineers are not system programmers. They don't care about vendor lock because they're not the ones writing the drivers.
1. It's just not a huge deal to many people. Most people who want to do local ML training and inference can just buy a NVIDIA GPU.
2. AMD only has a skeleton team working on their solution. It's clear it's not a focus.
The setup.py file seems to indicate that PyTorch is used, which I think can also run on AMD GPUs, provided you are on Linux.
And if I don't have enough system RAM, bring it in from a file on disk.
Tha majority of the ram is consumed by big weights matrices, so the framework knows exactly which bits of data are needed when and in what order, so should be able to do efficient streaming data transfers to have all the data in the right place at the right time. It would be far more efficient than 'swap files' that don't know ahead of time what data will be needed so impact performance severely.
I don't know where that imagined number came from. This tool appears to be using Stable Diffusion, and the base Stable Diffusion model is 4 or 5 gigabytes by itself. I think there are some other models that are necessary to use the base Stable Diffusion model, and while they are smaller, they still add to the total size.
This stuff is fascinating, and @bryced's imaginAIry project made it accessible to people like me who never had any formal training in machine learning.
Note the level of investment that NVIDIA's software team has here: they have a separate WSL-Ubuntu installation method that takes care not to overwrite Windows drivers but installs the CUDA toolkit anyway. I expected this to be a niche, brittle process, but it was very well supported.
I’ll keep you posted how well this works for dating apps
This isn't running on a website that is open to everyone or can be easily run by a novice.
Anyone capable of installing and running this is also able to read code and remove such a feature. There is no reason to hide this nor to not document it.
Also the amount of nudity you get is also highly dependent on which model you use.
The default is:
negative-prompt:"Ugly, duplication, duplicates, mutilation, deformed, mutilated, mutation, twisted body, disfigured, bad anatomy, out of frame, extra fingers, mutated hands, poorly drawn hands, extra limbs, malformed limbs, missing arms, extra arms, missing legs, extra legs, mutated hands, extra hands, fused fingers, missing fingers, extra fingers, long neck, small head, closed eyes, rolling eyes, weird eyes, smudged face, blurred face, poorly drawn face, mutation, mutilation, cloned face, strange mouth, grainy, blurred, blurry, writing, calligraphy, signature, text, watermark, bad art,"Banning an entire class of activity because someone somewhere might abuse it is a ridiculous irrational way to reason about things.
The question is simple: Will the thing mostly be used for bad or good? Unless you think the vast majority of humanity are pedophiles then these features should be allowed.
Think of the children was never a valid argument and isn't a valid one today. I truly hope this utterly stupid and brain-dead way of thinking never escapes the AI community and infect other fields.
A. Get over it.
B. Ban the tool in its entirety.
C. Waste tons of governmental resources, spy on people more, and operate in legal grey-area to hunt down people that produce that kind of stuff with these models.
The correct answer seems obvious to me.
- the tool is drawing original content. - the tool is executing on my laptop. - the output image is not shared with anyone.
In a way, whatever this tool can do, MS Paint could (theoretically) do.
Or am I misunderstanding the whole thing?
In general it's a topic people are careful about because the legal situation is complex, and in many countries associated with the potential of heavy jail sentences.
1: https://en.wikipedia.org/wiki/Legal_status_of_fictional_porn...
I’ve been looking for an easier way to replace the text in these ai generated images. I found Facebook is working on it with their TextStyleBrush - https://ai.facebook.com/blog/ai-can-now-emulate-text-style-i... but have been unable to find something released or usable yet. Anyone aware of other efforts?
I'm on mobile so can't try this myself now. Can it add a Klingon bird of prey flying under the Golden Gate Bridge, and will "add a Klingon bird of prey flying under the Golden Gate Bridge" prompt/command be enough?
/Sighs in Intel iMac
Has anyone managed to get an eGPU running under MacOS? I guess I could use Colab but I like the feeling of running things locally.
Thank you for creating this.
Downloading https://huggingface.co/runwayml/stable-diffusion-v1-5/resolv... from huggingface Loading model /home/hrishi/.cache/huggingface/hub/models--runwayml--stable-diffusion-v1-5/snapshots/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt onto cuda backend...
followed by a download
Also any way configure the generated file path beyond directory or directly pipe image from the CLI?
PS: I'm not trying to make a comic book, I'm trying to help a friend solve a far more basic business problem (trying to get clients to pay their bills on time).
Dreambooth is ok at it, but it requires multiple images (you often read 30, but I've actually had decent results with as few as five) to recognize what it's supposed to replicate. I remember there were tools that were more adapted to the workflow "create a humanoid cartoon character with a bunny face", pick one image that you like, and then "now show that same character in scene X, eg teaching in a classroom" or "wearing a cowboy outfit".
Works perfectly for me (Gentoo Linux + nVidia RTX3060 12GiB VRAM - I installed last week your package and it just worked, experimenting with it since then, telling about it parents & colleagues).
The results (especially in relation to "people's faces") can vary a lot between ok/scary/great (I still have to understand how the options/parameters work), all in all it's a great package that's easy to handle & use.
In general, if I don't specify a higher output resolution setting than the default (512x386 or something similar), with e.g. "-w 1024 -h 768", then faces get garbled/deformed like straight from a Stephen King novel => is this expected?
Cheers :)
Our "cluster" is running on a ASUS ROG 2080Ti external GPU in the razer core-x housing, and that actually works just fine in my flat.
We went through several iterations of how this could work at scale. The initial premise was basically the google homepage, but for images.
That's when we realised that scaling this to serve the planet was going go be a hell of a lot more work. But not really, conceptualising the concurrent compute requirements as well as the ever-changing landscape and pace of innovation in this absolutely necessary.
The quick fix is to use a message queue (we're using Bull) and make everything asynchronous.
So essentially, we solved the scaling factor using just one GPU. You'll get your requested image, but it's in a queue, we'll let you know when it's done. With that compute model in place, we can just add more GPUs, and tickets will take less time to serve if the scale engineering is proper.
I'm no expert on GPU/Machine learning/GAN stuff but Stable Diffusion actually prompted me to imagine how to build and scale such a service, and I did so. It is not live yet, but when it does become so the name reserved is dreamcreator dot ai, and I can't say when it will be animated. Hopefully this year.
I'm glad you have this working but I wouldn't exactly call this "solving the scaling problem", you're just running it in a blocking "serial fashion". With enough concurrent users it could still take somebody until the heat death of the universe for their image to finally be generated.
Your queue decouples demand from supply - though you now have another problem - if demand far exceeds supply will your queue overflow?
In that scenario you might need to push the queue back to the requester - ie refuse the job and tell them to resubmit later.
I was thinking of deploying something like that in one of our app features, but I'm scared of making our Users look like vampires :-)
Is it your experience that the model struggles more with faces than with other changes?
A few questions:
- would it be possible to use this tool to make automatic mask for editing in something like GIMP (for instance, if I want to automatically mask the hair)?
- would it be possible to have a REPL or something else to make several prompt on the same image? Loading the model takes time, and it would be great to be able to just do it once.
- how about a small GUI or webui to have the preview immediately? Maybe it's not the goal of this project and using `instruct-pix2pix` directly with its webui is more appropriate?
Thanks for the work (including upstream people for the research paper and pix2pix), and for sharing.
probably but GIMP plugins are not something I've looked into
> REPL
already done. just type `aimg` and you're good to go
> GUI
GUIs add a lot of complexity. Can your file manager do thumbnails and quick previews?
Somewhat OT, but I find this really funny. It says a lot about the difficulty of using various ecosystems and where communities spend time polishing things.
"Yeah, I made something that takes natural language and can do things like change seasons in an image. But a GUI? That's complicated!"
It's not a criticism of you, but the different ecosystems and what programmers like to focus on nowadays.
It's not just that GUI's are hard, it's that the "customer" base will inevitably be much less technical and I'd receive a lot more difficult to resolve bug reports. So no-gui is also a way of staying focused on more interesting parts of the project.
> probably but GIMP plugins are not something I've looked into
I was just thinking about a black and white or grey level output image with the desired area , no need to integrate it in GIMP of whatever. I've tried a prompt like "keep only the face", but no luck so far.
It could be random and my imagination, but seems that way.
Aaarrrgghh let me know when it's down to 4GB like Stable Diffusion
The prompt-based masking sounds incredible, with either pixel +/- or Prompt Relevance +/-
VERY impressive img2img capabilities!
1. It actually makes me insecure.
2. Don't we already have apps that do such things? Yes, they were more specialized, but it's the same thing as Prisma app.
I am just trying to avoid some of the basic VM admin stuff like creating, starting, stopping for SaaS if someone already has a way to do. Maybe this is something like what Elastic Beanstalk does.
Never used it myself, but looks like AWS Lambda/GCP Cloud Functions tailored to ML models.
I run a friendly caption contest https://caption.me so imaginAIry is going to be absolute gold for generating funny and topical content. Thank you @bryced!
Great stuff man, thanks!
Can this be run on a Digitalocean VM?
I looked around on DO's products, but none seems to advertise that it has a GPU. So maybe it is not possible?
(no affiliation other than being a happy customer)
And they aren't kidding that on a CPU backend it is slooooow :)
Maybe todays example is a smart voice assistant like Alexa.
Like, come on. We're now seeing AIs take on tasks many people thought would never be doable by machine. And granted, many people (myself included to some extent) have adjusted their priors properly. And yet so many people act like AI is going to stall in its current lane and leave room for human work as opposed to developing orders of magnitudes better intelligence and obliterating all of its current flaws.
I've been pretty disappointed to introduce ChatGPT to people in jobs where it would be a game changer and they just don't know what to do with it. They ask it for not-useful things or useful things in a non-productive way. "here is some ad copy I wrote, write it better". Whether you're instructing a human, chatgpt, or AI god... that's just too vague of instructions.
It was a very important skill for searching. Nowadays, with Google "I know what you want better than you" search, it’s not that useful anymore (not useless, I get better search results by not using google and knowing what I want, just less required).
Soon we will see AI being used to define semantic operations on images that are hard to define exactly (imagine a knob to make an image more or less "cyberpunk", for example).
I also expect AI-powered inpainting to become a ubiquitous piece of functionality in drawing and editing tools (there are already Photoshop plugins).
Furthermore, my hunch is that many of the use cases around image creation will gradually move towards direct manipulation. Somewhat like painting, but without a physical model. AI components will be probably applied to interpreting the user's touch input in a similar way to how they are currently deployed to understand text input.
* The amount of times that I've seem an 'impressive' selections of AI images that I consider a critical failure deserves it's own word. The AIs are impressive for even getting that far, it's just that some people have bad taste and pick the bad outputs.
Yes, it's true that not all technology evolves as fast as predicted (by some, at some point), but first of all I still believe we will see self driving cars in the future and secondly, it's one anti-example in a forest of examples of tech that evolves beyond anyone's expectations. I don't find it very convincing.
We might need to create real intelligence for that to become true. A machine that can think and is aware of its purpose.
InvokeAI (and a few other projects as well) already does all this stuff much better unless I’m missing something. There are plenty of stable diffusion wrappers. Why not help improve them instead of copying them?
I’m not against having enthusiasm for one’s project, but tell us why this is different and please don’t pretend the other projects don’t have this stuff.
If I am mistaken please provide links to these prior features.
Make your own art, dammit. This is the equivalent running some Photoshop filters through someone else's work.
Letting the user upload dozens of images and only after that telling them they need an account. Not good.
You are entitled to your opinion, no matter how wrong many of us think it is :)
> what would happen to the images after uploading?
I have no idea, as there is no such information given going as far as the upload form, nor in the FAQ. This is information you should provide.
Though that isn't the key problem IMO. For someone who backs out because of the sign-up requirement, you've wasted their time (and the service now has their images with no obvious pre-agreed policy covering re-use or other licensing issues).