-
Notifications
You must be signed in to change notification settings - Fork 13
Could there be a button to align all sliders to a keyword? #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
IMO seems possible, but right now the guidance is only used to show the markers via JavaScript. Possibly something that could be operated on via JavaScript or a button operator to trigger something inside the Python code. I personally would be interested in this as well, as going through multiple layers and tuning it seems impractical. I will consider giving it an attempt if I have some free time. My question would be if it makes sense to do this automatically, since it might not always work well. Some weights might have more importance, so changing a lot of them at the same time might produce poor results. |
Maybe it could offer to do it gradually, but precisely, one slider at a time when fine tuning. An option to visualise roughly what noises are contained under each slider would be interesting. |
What do you mean by visualize the noises? |
Noises must have some kind of a visible matrix to them, a bit like TV noise, with some visible shapes and patterns and deformations that could indicate what is present at X depth in the selected section of the noise array. |
Hmm, that does sound interesting. I'm still learning about embeddings. Any examples of this noise elsewhere? In my mind, I'm trying to figure out why would someone make an embedding through like training vs moving these sliders around. Training seems to maybe get to the result eventually, but have some side effects of the model it's trained on. If the sliders were automated between 2 points, why would it need to have such an expansive list of sliders. Could happen just as a product of a function. Of course, this depends on the sliders being something that can be represented by tokens vs adding something fundamentally new as an embedding, so maybe that's the difference. Trying to equate something that's somewhat already in the system, but in between. |
There's 768 sliders per vectors. |
8000
If someone wants to experiment with this I've put together a little JS function which will automatically set all the sliders to their guidance values. It can be used with a single keyword for now but it could be easily expanded. It would have been more sensed to just get the guidance values in JSON from gradio, and update the sliders accordingly, but I am not familiar with gradio, so I just made this quick and dirty test... Just enter a single keyword in the extension UI, get its guidance values by pushing the button, and then run this to update the sliders values.
The sliders position is not actually changed but their values is (don't know how to make the UI refresh). |
Awesome! Just one question... How is that script meant to be ran? With a JS injection extension of some sort? Or by editing a file in SD? |
Looks like you'd need to run the code in your browser manually. See https://developer.chrome.com/docs/devtools/console/javascript/ The 2 functions can be run once (will remain available), and then you would need to run the function each time you change the token. Then you can run the following in the browser console.
|
Yes exactly... just copy-paste everything in the console, go the UI and work as usual, adding one token and pressing the button to get its guidance values, then just go back to the console and run But since I have almost zero experience with gradio and I have never actually examined how data is stored inside an embedding file, it would be wise if one of you guys could just make sure the values are actually retained in it after pressing the Save button... |
I'm exploring the possibilities of this extension in my fork, in addition to trying to improve the UI/UX. |
I have read into your description. If each slider had a display of the selected word at the position of the slider, it could help understand better what's going on and why the AI selected these noises while training from whatever data it's been trained on. |
I'm currently working on that now. I've been able to determine that for a given version of a base model (so SD 1.x or SD 2.x), any specific token that the model knows has a static weight, regardless of whether the model was mixed or fine tuned. I'm currently pickling an index and am going to see about doing similarity checks on each weight to try and generate a list of similar tokens for any given weights value. |
I've attempted an implementation of this but I'm not sure how effective it actually is. The current implementation is doing an absolute distance check rather than taking into account the direction in latent space. This is giving what appear to be undesirable results. I'm not experienced enough in this stuff to know how to resolve this particular issue. If anyone wants to take a look, here is my implementation: |
Update: After a lot of trial, error, testing, and validation, I've managed to find a fairly accurate method of doing this. Since I want to be able to run this in real-time I'm precomputing all of the values for every weight through the entire min/max range for that specific weight. It should be done in approximately 8 hours. I've already build a precomputed index of the weight values for every token in the Stable Diffusion vocabulary, so between these two indexes I should have everything I need to make this happen. The functionality to create both pickled indexes is implemented in my branch and only requires a button click |
@Zetaphor has there been any progress on this that can be merged? |
@illtellyoulater Yes and no, it's still very much in the experimental stage. I've done a precomputation at a precision of 0.001 but I found that was not accurate enough. That took 8 hours to perform (16 after an initial failed attempt). Since that time I've been preparing to move out of the country so I haven't had the time yet to prepare a new run at a precision of 0.00001 or higher, which will take at least 3 or 4 days. If someone wants to spare some compute and run that I could easily pick up the work as all of the functions for doing the distance checks are already in place, they just need final wiring and polish, and then a UI implementation which I've also already started. All of my work should be fairly easy to grok in the fork, everything is broken into distinct functions and there's even buttons to run all of it. If nobody else wants to pick up the mantle it will have to wait until I've moved and settled in before I can dedicate any serious time to it again. |
It's a lot of clicking to imprecisely adjust sliders along the colours matching keywords.
It could be done in 1 click with a proper UI function.
It could also be possible to align the slider between 2 different colours, and make it 80% or 90% closer to X colour for fine tuning.
Example, making the slider on 90% "hand" and 10% "fingers" so it hopefully doesn't overlap with feet and toes.
The text was updated successfully, but these errors were encountered: