[HN Gopher] Charl-e: "Stable Diffusion on your Mac in 1 click"
       ___________________________________________________________________
        
       Charl-e: "Stable Diffusion on your Mac in 1 click"
        
       Author : valgaze
       Score  : 155 points
       Date   : 2022-09-17 16:05 UTC (6 hours ago)
        
 (HTM) web link (www.charl-e.com)
 (TXT) w3m dump (www.charl-e.com)
        
       | gcau wrote:
       | A.I projects (and maybe all python projects in general) seem to
       | always be ridiculously tedious, error-prone to get running, such
       | that its a rare, celebratory thing when someone releases
       | something that's easy to use like this?
        
         | mrtksn wrote:
         | Unfortunately this goes beyond A.I. stuff, it has become the
         | state of software development and that's why people started
         | shipping very large packages of everything so that you can have
         | the exactly same environment so you can increase your chances
         | that the code will run as expected.
         | 
         | For A.I. stuff I actually don't judge, these scripts are
         | written by people who specialise in other things than software
         | engineering and they simply put together some code to run their
         | algorithms and as a result they are poorly engineered in many
         | aspects.
        
         | somehnacct3757 wrote:
         | These AI tools are going to be built into professional tools
         | like Photoshop someday, but until then it's sort of a hackers
         | paradise. I think Charl-e lets a new cohort of hackers play
         | with the technology without becoming python command line
         | warriors
        
         | [deleted]
        
         | kragen wrote:
         | Cutting-edge software has always been like this. Web browsers
         | were like this 30 years ago. Linux was like this 25 years ago.
         | DNS and Unix were like this 40 years ago. AJAX and Comet (and
         | really JS in general) was like this 20 years ago. Operating
         | systems and high-level languages were like this 50 years ago.
         | It takes a while for the rough edges to get sanded off.
         | 
         | Most Python projects install with a matter of a single pip
         | command.
        
           | userbinator wrote:
           | Back then, as in the early years ot the PC, software was
           | mainly self-contained, single-executable extract-and-run.
           | 
           | Somewhere along the way, they became so complex as to require
           | special installation programs and the like.
           | 
           | I'm not very familiar with AI and SD in particular, but from
           | what I understand, this stuff is mostly-pure maths, so it
           | shouldn't be a difficult thing to package and make portable.
           | I know the models are rather large, but that's not really any
           | additional complexity.
        
             | mgraczyk wrote:
             | The largeness of the model does add complexity, you can't
             | really package it as part of the binary for example.
             | 
             | It's not the case that useful software was ever self
             | contained. If you recall trying to do anything online in
             | the early to mid nineties, you'll remember how complicated
             | it was to use almost any website and how much manual
             | fiddling and configuration was involved to get online.
             | 
             | Ignoring the internet, early games and graphical
             | applications were a mess of settings and configuration.
             | Even today you often have to tune graphics settings to get
             | playable game performance on anything but top line
             | hardware.
        
             | kragen wrote:
             | When you say, "Back then," do you mean 30 years ago, 25
             | years ago, 40 years ago, 20 years ago, or 50 years ago?
        
             | y42 wrote:
             | >> Back then, as in the early years ot the PC, software was
             | mainly self-contained, single-executable extract-and-run.
             | 
             | Software in general? Yes. But of you tried to leave the
             | path the manufacture prepared, then you entered a world of
             | pain. I remember how difficult it was to connect my first
             | smartphone around 20 years ago to my Windows PC using
             | ActiveSync to achieve a synced calendar. Just one example
             | of: there was no download and run solution for processes
             | that seem simple today.
        
           | solardev wrote:
           | ...Comet? Is that a joke, lol? Because of the Ajax and Comet
           | cleaners? I've never heard that term before
        
             | lbotos wrote:
             | nope, (well yes it was a reference) but was a strategy in
             | the early '00s:
             | 
             | https://en.wikipedia.org/wiki/Comet_(programming)
        
               | kragen wrote:
               | It still is, it's the heart of many of the most popular
               | current apps like Slack, we can just do it without the
               | dirty hacks because we have WebSockets.
        
         | EamonnMR wrote:
         | Most Python projects aren't this tough. I suspect that they're
         | using wonky libraries like Pandas, Numpy or some such that
         | prioritize raw power over ease of installation.
        
           | CodeSgt wrote:
           | I've not touched Python in a couple years, but Pandas/NumPy
           | used to be _the_ defacto libs for anything to do with data
           | science, are they considered  "wonky" now?
        
             | machinekob wrote:
             | 2be honest numpy is ez to install on all major platforms.
             | In deep learning I'm almost never saw usage of pandas but
             | deep learning models have problems with PyTorch as some
             | projects just lock old PyTorch version that just dosent
             | work on new/old python version.
        
             | gbear605 wrote:
             | In my experience, they're simultaneously important for data
             | science and very annoying to install and manage.
        
               | Fomite wrote:
               | I mean, there are at least two different companies
               | (Enthought and Continuum) that were founded on making the
               | major scientific python packages easier to install.
        
             | version_five wrote:
             | Just to be clear, pandas and numpy are not the "wonky"
             | libraries. They are, in my experience, basically two of the
             | most easily installed and dependency managed libraries in
             | python, given their ubiquity and maturity. Maybe there are
             | machine configurations I'm not familiar with that they are
             | not easily compatible, but I've never seen them cause
             | issues. Usually it's cuda or other gpu stuff, or conflicts
             | in less regularly maintained packages
        
         | sp332 wrote:
         | A bit, yeah. And it's been extra difficult to get it going on
         | M1 Macs.
        
           | latchkey wrote:
           | lstein's fork [1] isn't that bad and the instructions are
           | pretty easy to follow. It definitely requires some knowledge
           | of how to install software via brew, but these are generally
           | good to figure out anyway.
           | 
           | [1] https://github.com/lstein/stable-
           | diffusion/blob/main/docs/in...
        
         | amelius wrote:
         | IT is in a package management crisis at the moment, and GPUs
         | are not making things easier.
        
           | smlacy wrote:
           | What's the relationship between GPUs and package management?
        
             | hunkins wrote:
             | Most deep learning these days requires CUDA acceleration to
             | enable GPU / TPU for the libraries (i.e. PyTorch,
             | Tensorflow), which is an absolute nightmare to set-up.
        
               | gpderetta wrote:
               | I wanted to try SD on my machine, but I just couldn't get
               | CUDA to work. Mind, the the openvino based CPU
               | implementation works just fine (pip install -r
               | requirements.txt was sufficient) and given my CPU and GPU
               | (a 10 core 10850k and and old 1070), there's isn't
               | probably much to gain to switch to the GPU other than
               | power usage.
        
               | thebruce87m wrote:
               | NVIDIA has a bunch of docker containers which make this
               | slightly less painful. Or maybe it's just a different
               | kind of pain.
        
               | hunkins wrote:
               | These definitely help.. but still painful.
        
               | 1024core wrote:
               | I guess the old "NVidia -vs- Linus" battle on kernel
               | modules is still being fought....
        
       | dqpb wrote:
       | It's awesome to see how much creativity, progress, and community
       | involvement results from truly open AI development.
       | 
       | Congrats to the stable diffusion team for their openness and
       | inclusiveness!
        
       | mig39 wrote:
       | Is there a reason it won't work on an intel Mac?
        
         | zodo123 wrote:
         | People have been focused on getting stable diffusion running
         | well on M1 macs because their graphics systems have so much
         | more horsepower than the Intel macs. The M1s also have a fast
         | memory sharing architecture for graphics, and this needs an
         | absolute minimum of around 8gb of vram -- many Intel macs just
         | won't be able to handle this.
        
           | wasyl wrote:
           | SD on an Intel mac with Vega graphics runs pretty well though
           | -- I think it ran at something like ~3-5 iterations/s for me,
           | which is decent. I ran either
           | https://github.com/magnusviri/stable-diffusion or
           | https://github.com/lstein/stable-diffusion which have MPS
           | support
        
             | anigbrowl wrote:
             | That's good to know as I just got a good deal on one and
             | was wondering if the AMD GPU would be useful or if I needed
             | to start planning for an eGPU with some NVidia silicon.
             | Thanks!
        
         | halefx wrote:
         | From the website:
         | 
         | > Will this be available on Intel Macs?
         | 
         | > Yep, I'm working on making it compatible with older Macs.
        
       | selfsimilar wrote:
       | What's the difference between this and Diffusion Bee besides a
       | nicer website?
       | 
       | https://github.com/divamgupta/diffusionbee-stable-diffusion-...
        
         | okdood64 wrote:
         | There's a link to a code on the `nicer website`:
         | https://github.com/cbh123/charl-e
        
       | yummybear wrote:
       | I have a mac a few years old, and now we start seeing M1 only
       | software. My next computer won't be a mac.
        
         | addaon wrote:
         | Then it is unlikely that either your current or your next
         | computer will be able to run M1-only software. What problem are
         | you trying to solve?
        
       | murkt wrote:
       | Has Stable Diffusion been optimized already so it could run on M1
       | with 8 GB of RAM without swapping?
        
         | cowmix wrote:
         | I highly doubt it. It Struggles on GPUs with 6GB or less.
        
       | prpl wrote:
       | I had Stable Diffusion running on m1 and intel macbooks vein the
       | first few days, but the original repo would have done people some
       | favors if they either created proper conda lock files for several
       | platforms or just used conda-forge instead of mixing conda and
       | unnecessarily (I think there was one dep which actually wasn't on
       | conda-forge, besides their own things)
       | 
       | (and actually made the code independent of cuda)
        
       | russellbeattie wrote:
       | I downloaded this and tried out a few prompts like, "Mark Twain
       | holding an iPhone", and got back an image of Mark Twain - once in
       | some surrealist nightmare fashion and another more like a 3D
       | render. Neither were holding anything, let alone an iPhone.
       | Cranking up the DDIM slider didn't seem to do much. Trying the
       | same prompt on mage.space (see the creators comment in this
       | thread) produced exactly what I assumed it would.
       | 
       | Is there a trick to it?
        
       | takoid wrote:
       | Does a "1 click" Windows implementation of Stable Diffusion exist
       | yet?
        
         | filoleg wrote:
         | Had been available for a while, check out NMKD[0]. That's what
         | I've been personally using the entire time.
         | 
         | 0. https://nmkd.itch.io/t2i-gui
        
       | teaearlgraycold wrote:
       | Anyone have an M1 Ultra they can test this on? My 3080 Ti can
       | render a 512x512 image in something like 7 seconds and I've love
       | to compare against Apple Silicon.
        
         | geerlingguy wrote:
         | On M1 Max Mac Studio I'm getting about 45s. On my 3080 Ti about
         | 5-7s.
        
         | latchkey wrote:
         | M1 max 16" with 64gigs ram, lstein fork, about 30-40s.
        
         | machinekob wrote:
         | There isn't any optimised diffuser on m1 yet most of them are
         | just running basic MPS graph or even mix of CPU and MPS ops and
         | ofc it is extremely slow I dont have time to test this
         | implementation but author just use some other implementation
         | with simple UI. So I would be surprise if it is faster than 10s
         | per img with 20steps and probably more close to 25-40s and
         | around 40s-1min per classic 512x512 50-60 step setting as are
         | other models.
        
       | ISL wrote:
       | Seeing copyrighted/trademarked icons in the examples (Darth
       | Vader, for example) really makes me wonder how these models are
       | going to play out in the future.
       | 
       | Today, these models are far ahead of the trademark attorneys, but
       | there are powerful interests that are going to want to litigate
       | the inclusion of these entities in the trained models themselves.
        
       | city17 wrote:
       | How fast does Stable Diffusion run on an M1 Max? I'm using an M1
       | Pro and I find it too slow. I'd rather use an online service that
       | costs $0.01 per image but generates an image in a matter of
       | seconds than wait 1 minute for a free one.
        
         | cammikebrown wrote:
         | It takes 20-30 seconds on my M1 Pro with 32GB RAM. I'm not sure
         | I've seen anything faster online.
        
           | pavlov wrote:
           | I clocked 18 seconds for a 512*512 image, 25 steps, on a Mac
           | Studio with M1 Max and 32GB.
        
             | culi wrote:
             | FWIW I don't I've ever gotten a satisfactory result from
             | anything less than 50 steps
        
               | pavlov wrote:
               | Interesting. I didn't see an essential difference with
               | higher values, so I settled on 25. Maybe I'm just
               | impatient and my brain prefers more options even if
               | they're individually imperfect.
        
               | brnaftr361 wrote:
               | Depends on the diffuser you're using, the _a (ancestral)
               | diffusers are aberrant in that they can yield good
               | results with very low sample counts. I typically use 16
               | samples and get reasonably good results, but it's highly
               | dependent on the prompt and settings as well.
        
           | city17 wrote:
           | On Replicate it takes maybe around 10-15 seconds. My M1 Pro
           | only has 16GB and 8 cores and takes about 1 minute, so maybe
           | the lower specs make quite a difference.
        
           | hunkins wrote:
           | You should be able to get a regular prompt to generate in 5
           | seconds via https://mage.space. A100s under the hood.
           | Unlimited too. (Note: I am the creator)
        
       | Bolkan wrote:
       | Clickbait. I clicked on this link. Nothing happened.
        
       | dr_dshiv wrote:
       | Speed has a massive effect on how willing I am to play around and
       | develop better prompts. I can't wait a full minute for an image,
       | I just can't.
       | 
       | What kind of computer specs would be required to generate typical
       | SD images in less than a second?
        
         | Art9681 wrote:
         | I built a Svelte frontend for my SD instance and occasionally
         | expose it to friends publicly. It runs on an old intel 6700k
         | with a 2080ti and ive tuned it to generate images in about 5
         | seconds. The speed depends on various factors but you can
         | prototype with settings that can generate images as low as 3
         | seconds and work your way up to more complex images.
        
         | cstejerean wrote:
         | I don't know about less than 1 second but I just picked up an
         | RTX 3090 Ti now that they're basically half off at Best Buy and
         | it's definitely fast enough for interactively playing with
         | prompts (single digit number of seconds).
         | 
         | Probably overkill and could get away with something like a 3060
         | or so, but the 24 GB of VRAM come in handy if you want to
         | generate larger images. I pushed it as high as 17 GB on some
         | recent runs.
        
           | sdflhasjd wrote:
           | Roughly 4-5 seconds for 512x512 at 50 samples on a 3090 Ti
        
           | selectodude wrote:
           | The nice thing about the M1 is that the GPU and CPU share RAM
           | so even though I have a 14" MacBook Pro, I also have a GPU
           | with 16GB of VRAM. I pushed as high as 11GB on images and the
           | fan didn't even turn on.
        
           | midwestemo wrote:
           | Have a 3060 and it's fine for me, took me ~8-9 secs to
           | produce it at default settings
        
         | skybrian wrote:
         | It takes a few seconds (haven't timed it), but I suggest doing
         | it online at dreamstudio.ai. Paying about one cent per image
         | isn't so bad.
        
         | lbotos wrote:
         | I was using https://www.coreweave.com/gpu-cloud-pricing the
         | A4000s here, with 20ish steps 512x512 and I think it was close
         | to a 1-2 s IIRC. There are some consumer cards that can get
         | close i'm sure with some tweaking of image size, steps and
         | other SD tuning.
        
         | brnaftr361 wrote:
         | My 3080 can turn a 16 sample Euler_a @ 512^2 in about 1.5s (9.7
         | iterations/s). I've found you can yield pretty good results in
         | txt2img with the settings. And once you've found a good image
         | you can further iterate in img2img with loopback at
         | approximately the same rate.
         | 
         | It's worth noting that I'm on a 5800X as well, I'm sure.
        
           | michaelchisari wrote:
           | > _iterate in img2img with loopback at approximately the same
           | rate._
           | 
           | What's the advantage of using img2img as opposed to iterating
           | on the seed value?
        
             | PetahNZ wrote:
             | You draw over the part of the image that is not ideal and
             | get it to infill it
        
       | theodric wrote:
       | Have they fixed it? I installed it in a virgin macOS 12.5
       | instance on Wednesday and it didn't work at all
        
       | johnklos wrote:
       | Perhaps "Stable Diffusion on your ARM Mac in 1 click" would've
       | been a more helpful title.
        
       | hunkins wrote:
       | Love it. If you don't have an M1 Mac, or don't want to wait,
       | https://mage.space does unlimited generations currently. (Note: I
       | am the creator!)
        
         | MuffinFlavored wrote:
         | I feel like this can't be cheap to run?
        
           | hunkins wrote:
           | We're using GPU serverless (via banana.dev), so it's actually
           | not bad. Will have limits at some point, for now go wild.
        
             | stavros wrote:
             | Thanks for the shout, I've made something similar to yours
             | (https://phantasmagoria.stavros.io/) and I needed a GPU
             | backend. Trying out their sample script, it seems to take a
             | minute or so to just error out with "taskID doesn't exist"
             | or similar. Have you hit that issue too?
        
               | hunkins wrote:
               | They're very early in the space. Would recommend looping
               | back with them on Monday in their Discord. Haven't seen
               | that specific issues personally yet though.
        
               | stavros wrote:
               | Ah, thanks! I didn't notice their Discord, I'll join
               | right away.
        
       | fermentation wrote:
       | This is really cool and a fun way to try out this stuff I've been
       | hearing about. One thing that'd be cool is a "retry" button that
       | picks a different seed. My first attempt didn't turn out so great
       | (https://i.imgur.com/zV48hCV.png)
        
       | wasyl wrote:
       | Is there some comprehensive source about how to make the most of
       | Stable Diffusion? I find the examples on websites much better
       | than what I've been able to generate -- they more closely convey
       | the prompt and have less artifacts/clearly messed up parts
        
         | macrolime wrote:
         | I've found the stuff in the DALL*E 2 Prompt Book also works
         | well for Stable Diffusion
         | 
         | https://dallery.gallery/the-dalle-2-prompt-book/
         | 
         | If one prompt doesn't work, try writing it in another way.
         | Sometimes it helps to write things in multiple ways in the same
         | prompt.
        
         | gedy wrote:
         | Agreed and wondering myself, DALL-E seemed to do a better job
         | of great looking images with brief prompts, but Stable
         | Diffusion seems to need more specific prompts. SD is free
         | though so would love to use it more.
        
         | Metricon wrote:
         | The reddit forum for StableDiffusion has a tag for prompts
         | where you can get a large number of detailed examples to use:
         | 
         | https://www.reddit.com/r/StableDiffusion/?f=flair_name%3A%22...
         | 
         | Also, this post refers to a large number of relevant tools to
         | use as well:
         | 
         | https://www.reddit.com/r/StableDiffusion/comments/xcrm4d/use...
        
         | Nadya wrote:
         | When people call themselves "prompt engineers" it's only half
         | in jest. Half of generating something good is guiding the
         | program into generating something good. That means knowing the
         | right keywords to get specific styles or effects, a little bit
         | of luck, and sometimes generating a prompt several dozen times
         | and then creating variations from a seed once you find a
         | specific seed that generated something close to what you liked.
         | It's an iterative process and many of the fantastic images you
         | see weren't "first generations" but likely the 20th or so
         | generation after tons of trial and error working around a
         | specific prompt/idea.
         | 
         | I'd recommend keeping a prompt list and finding what
         | does/doesn't work for what you're after. Try shuffling the
         | order of your prompt - the order of the tokens does matter!
         | Repeat a token twice, thrice, hell make a prompt with nothing
         | but the same token repeated 8 times. Play around with it! If
         | you find an image that's very close to what you want - start
         | generating variations of it. Make 20 different variations. Make
         | variations of the variations you like best.
         | 
         | Also the seed is very important! If you find a seed that
         | generated a style you really liked take note of it. That seed
         | will likely generate more things in a similar style for similar
         | enough prompts.
         | 
         | It's a semi-creative process and definitely takes some time
         | investment if you want great results. Sometimes you strike gold
         | and get lucky on your first generation - but that's rare.
        
           | notahacker wrote:
           | If someone turns artist names and the quirky-but useful bits
           | of prompting like 'Unreal Engine' as an image sharpener into
           | a Mac app with Instagram style filters they'll make some
           | money...
        
         | nickthegreek wrote:
         | I search Lexica.art for the style I want, copy the prompt
         | associated with the work and edit it my needs.
        
       | dharma1 wrote:
       | How long until on-device stable diffusion on new iOS devices? RAM
       | will be a bottleneck I guess
        
       ___________________________________________________________________
       (page generated 2022-09-17 23:00 UTC)