5 ms·
Ask HN: For those using Stable Diffusion locally, how do you filter fishy repos?
I have been using the official release so far, and I see many new tools popping up every day, mostly GUIs. A substantial portion of them are closed-source, sometimes even simply offering an executable that you are supposed to blindly trust.
Not to go full Richard Stallman here, but is anybody else bothered by that? How do you deal with this situation, do you use a virtual machine, or is there any other ideas I am missing here?
- capableweb 4y agoI simply don't use the closed source ones? Easy to filter (can I see the source?), and helps if I want to contribute as well. Currently using https://github.com/hlky/stable-diffusion https://github.com/hlky/stable-diffusion + https://github.com/hlky/stable-diffusion-webui https://github.com/hlky/stable-diffusion-webui which are both FOSS and works well.
- fjfbsufhdvfy 4y agoIt's now enough to use the main repo only, because he's regularly copying over any changes. So don't need to manually copy those files across anymore.
- capableweb 4y agoAh, I didn't know that, already have symlinks + .gitignore setup so I can update both easily with `git pull`, but good to hear it's no longer needed. Any reason why the webui repository is not archived with a warning up top if it's been deprecated like you say?
- fjfbsufhdvfy 4y agoIt's not deprecated. He uses it for development and then copies the files across to the main repo. I don't really understand what benefits this setup has over making a dev branch in the main repo, but to each their own!
- rcoveson 4y agoWhoa there, that first link looks super sketchy. It seems like they just forked the original `CompVis/stable-diffusion` and replaced the license file in this commit: https://github.com/hlky/stable-diffusion/commit/b4c61769dfa13d022623f13491502bbac399887e https://github.com/hlky/stable-diffusion/commit/b4c61769dfa1...
- knaik94 4y agoThe have added a lot more to it than just change the license, and the replacement is to the GNU AGPL. The original wording in the license puts arbitrary and unenforceable limits on what the end user can do. I would argue the original repo license applies to the weights only and not the code wrapping it. This is completely valid. They have also made a way to use real-esrgan/gfpgan and so a license change is practicality required.
- rcoveson 4y ago> The have added a lot more to it than just change the license I see that, but that doesn't mean they can ignore the original license. > The original wording in the license puts arbitrary and unenforceable limits on what the end user can do. I'm totally with you here. The original license is absurd. Still doesn't mean we can fork the repo and replace the license without (probably) breaking the law. Which, by all means, do. In practice maybe nobody will care. I'm just pointing it out because it's sketchy. > I would argue the original repo license applies to the weights only and not the code wrapping it. Most of the clauses only apply to the weights, yes. The first clause in the license applies to the whole repo, though: "All rights reserved by the authors." > They have also made a way to use real-esrgan/gfpgan and so a license change is practicality required. I don't see how this is relevant. Even if there is a license conflict, the authors retain control over their source. A license conflict might lead to a damages settlement, or an order to halt distribution. It doesn't magically switch the license by implication.
- knaik94 4y agoThis repo doesn't distribute the model or weights directly. You are agreeing to the more limited upstream license of the original repo when you download the pre-trained model. If the repo came bundled with the pre-trained model then your concern is valid. In this case it is not.
- fjfbsufhdvfy 4y agoCurrently there is so much activity that for every closed source tool chances are there is an open source one that does the same. I simply use those instead, after skimming over the code for any obviously malicious activity.
- cpdean 4y agoWhat malicious activity in these repos have you come across? Do you know when you've missed something?
- fjfbsufhdvfy 4y agoSo far actually, none in the ones I used. It seems everyone is just excited about the tech :) For now, most of these tools are rather small wrappers around the original stable diffusion repo which is considered trustworthy, so there isn't that much to review. Things I generally look out for are setup scripts that install unusual packages, any file or network io activity, code that's been obfuscated, instructions that have you download checkpoints from unofficial sources, etc. Of course I can't know if I missed something...
- sp332 4y agoYou could use the Windows Sandbox to prevent them from accessing anything sensitive on your computer. https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview https://docs.microsoft.com/en-us/windows/security/threat-pro...
- smileybarry 4y agoSadly, Windows Sandbox doesn't expose a proper GPU interface, even games barely run. You can create a Hyper-V VM and use a vGPU instead (still requires some PowerShell fiddling) but I'm not sure if the same interfaces needed by ML are supported by Hyper-V paravirtualization.
- sp332 4y agoWhat's the difference between the vGPU in Sandbox and the one in Hyper-V?
- smileybarry 4y agoSandbox and Hyper-V both create a sort-of RDP-based redirected GPU, but Sandbox is restricted to the “basic” mode exposed by the built-in RDP control. Hyper-V has a similar one if you use the standard RDP console, but if you run a few cmdlets and use a different Remote Desktop app supporting graphics — e.g. Parsec — it can use a vGPU supporting real DirectX 10-12 (hardware API level, you can still use DX9 and such). But no NVIDIA/AMD/Intel drivers, so if you need PhysX, RTX and such, you’re screwed.
- TekMol 4y agoHow easy / hard is it to run those repos in Google Colab? That would be my preferred way to shield myself from the repo.
- dncornholio 4y agoWhy would I be bothered about what exactly? People should be free on what and how they release their stuff.
- fjfbsufhdvfy 4y agoSomeone taking advantage of all this excitement to get people to download malware sounds like a very reasonable fear, especially if the software is not coming from a known and reputable person/business. No one's saying you can't release closed source software - but of course other people are free to be afraid of running it as well.
- avg_dev 4y agoWhat’s more, I believe it is possible to release code with a closed license, permitting analysis without allowing derivative work. Edit: IANAL but here’s a resource: > You're under no obligation to choose a license. However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. If you're creating an open source project, we strongly encourage you to include an open source license. The Open Source Guide provides additional guidance on choosing the correct license for your project. From https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository https://docs.github.com/en/repositories/managing-your-reposi...
- dncornholio 4y agoOk, but again, why should I, or even Richard Stallman, be bothered about this? I couldn't care less, as does Richard, I assume.. I have the feeling OP feels left out because of closed binaries and thinks he should be entitled for everything based off Stable Diffusion __should__ be open source. OP asks how we should deal with this, but there's nothing to deal with actually.
- epups 4y ago
- cube2222 4y agoI've used [0], [1] and [2] so far. I only use open-source ones and quickly skim the source code for anything suspicious. I also only use ones with some degree of popularity, meaning that others have probably taken a look at the code as well. [0]: https://github.com/lstein/stable-diffusion https://github.com/lstein/stable-diffusion [1]: https://github.com/hlky/stable-diffusion https://github.com/hlky/stable-diffusion [2]: https://github.com/basujindal/stable-diffusion https://github.com/basujindal/stable-diffusion
- bheadmaster 4y agoPlease go full Richard Stallman. Control of computing is an all-or-nothing business - even a single compromised component can lead to compromise of the complete system. Don't trust opaque binaries. > How do you deal with this situation, do you use a virtual machine, or is there any other ideas I am missing here? If you really want to run that opaque binary, a virtual machine will give you a decent amount of security. With GPU passthrough, you can even get near-native speed, too.
- bhedgeoser 4y agoIf you've ever run an `npm install` you've executed 100s of opaque binaries on your machine.
- paskozdilar 4y agoWould you care to elaborate? I always thought npm was open-source-centric. If npm somehow ran opaque binaries, I'd really like to know about that.
- Something1234 4y agoDo you really think your average javascript developer is going to read and understand all of their dependencies?
- leppr 4y agoThere is no open-source requirement, like there would be on Gentoo packages for instance. NPM packages frequently pull arbitrary binaries in their install scripts.
- bhedgeoser 4y ago1. There are thousands of dependencies in a usual lockfile. 2. A package author can push something other than the repository contents to npm/ change contents before pushing to npm, making the whole open source thing useless. 3. As someone else pointed out, you can download+exec when an npm package is installed.
- 7373737373 4y agoOne big problem are also model weights serialized with (the likes of) pickle - which allows arbitrary code execution A lot of trust just to get some numbers
- zorgmonkey 4y agoEverything I've seen is still using the model from the original researchers, so as far as that threat goes you only need to trust the original model author and the author of the particular script you are using. If you want to inspect the serialized model file fickling looks like a very promising tool https://blog.trailofbits.com/2021/03/15/never-a-dill-moment-exploiting-machine-learning-pickle-files/ https://blog.trailofbits.com/2021/03/15/never-a-dill-moment-...
- 7373737373 4y agoThe model is hosted on many sites by now, so it is important to compare the checksums
- f38zf5vdt 4y agoThe official repos work fine. https://github.com/huggingface/diffusers https://github.com/huggingface/diffusers https://github.com/CompVis/stable-diffusion https://github.com/CompVis/stable-diffusion
- gigel82 4y agoI use the Docker one, fully insulates it from my actual machine; it's OSS, but there's a lot of code and downloading a bunch of models, packages and tools at build / run time so better safe than sorry.
- Jach 4y agoVM is a good idea. I barely even trust a lot of the open source stuff, there's deep stacks of magic (and not so magic) shit in modern machine learning, and too much "we depend on pip installing this particular git repo, sometimes a particular commit that you'll need to figure out lol". Some of the stuff people are building has looked interesting, but I'm going to let the dust settle for a while before I look into them more, and I'm particularly trying not to gum up my new machine with npm BS. For now, I've had enough fun with just the original repo (regrettably finally mostly figuring out how to use conda) which I setup a bit before the weights were released and haven't updated. (So I didn't need to bother removing the last-minute added watermark/filtering stuff.) I also sometimes test things with the network down to see if there's blatant surprising network connections, interestingly the default repo will ping a site for a resource it needs to download, but continues to do so even after you have it. Add the "local_files_only=True" param to the from_pretrained() method calls in ldm/modules/encoders/modules.py to stop it. (Oh thank the gods that I can just edit the py files to make local changes and they haven't tried to do some weird hybrid binary thing like other projects (ActivityWatch).) I also setup Real-ESRGAN to upscale some favorites, its results are pretty interesting. The executable binary blobs I've a natural inclination to distrust, but I can also see where they're coming from, culturally, and Most Of The Time it's not a problem, like random indie games you might download to try. (Besides, there are other binary blobs I depend on, like the nvidia driver...) Culturally it seems somewhat comparable to the gaming world or even demo scene or modding scene, where traditionally you don't often find much open source.
- foxhop 4y agoI tried to run locally but all I got is a black square for output. I used the scripts from this Repo https://github.com/basujindal/stable-diffusion https://github.com/basujindal/stable-diffusion which didn't give me a GPU memory error which the original link does.
- foxhop 4y agoI was missing a flag which appears optional but breaks, I needed `--precision full` otherwise black square.
- effnorwood 4y ago
- danwee 4y ago> ...sometimes even simply offering an executable that you are supposed to blindly trust. Then don't trust them. It's easy. If you don't have access to the source code, then assume the worst. If you absolutely MUST run executables of which you don't know what the hell is going on inside, then maybe run them in a secured container or something similar.