credits to Thyri
Perturbed Version of SD3 using script (replace input and output location)
download sd3 from huggingface
put script in a .py (replace input with sd3 model location and output location with where and what you want to name it). modify 0.01 to how much you want it to be perturbed (0.01 = 1%)
execute the .py using "python your_py_script.py" (maybe you need to activate your virtual environment)
import torch
from safetensors.torch import load_file, save_file
# Load the safetensors model
model = load_file('__INPUT LOCATION__')
# Extract the keys and tensors
keys = model.keys()
dic = {key: model[key] for key in keys}
# Define parts to filter
parts = ['diffusion_model']
count = 0
# Perturb the specified parts
for k in keys:
if all(part in k for part in parts):
v = dic[k]
print(f'{k}: {v.std()}')
dic[k] += torch.normal(torch.zeros_like(v), v.std() * 0.01)
count += 1
print(f'Total perturbed tensors: {count}')
# Save the perturbed model
save_file(dic, '__OUTPUT LOCATION__')
Description
FAQ
Comments (14)
I'm Thyri.
Doesn't work at all for me. Got this error in ComfyUI:
Error occurred when executing CLIPTextEncode: 'NoneType' object has no attribute 'tokenize' File "D:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\AI\ComfyUI_windows_portable\ComfyUI\nodes.py", line 57, in encode tokens = clip.tokenize(text) ^^^^^^^^^^^^^
Queue size: 0
Extra options
Running
Pending
It does seem to reduce body horror and improve the outputs in the limited testing I've done. Moving in the right direction!
Won't load for me in Swarm UI.
I'm not sure if I want to both since the description is one long dick joke.
Do I need to execute that code? I just have the model itself loaded. If so I don't know how to run that code.
展示图片有点吓人😰
You really are on to something with the perturbed models, Im trying the 2% and it is doing much better than base SD3.
Keep up the good work!
dic[k]
Hehe
Okay its 2B as well including clips and T5. So there is still a 4B and 8B one around. Its actually "small". Lots of strange chatter going on... i don't know to make heads or tails of it: https://www.reddit.com/r/StableDiffusion/comments/1dhd7vz/the_developer_of_comfy_who_also_helped_train_some/#lightbox I surely would love to get my hands on the 4B
Thank-you, a big improvement, but still quite restrictive.
I have an unpublished adaptation of SD3 medium, nobody can see it right now, if you archive it, can you unarchive it when Civitai allows SD3 models? 🙏
Ah, now it's clear. A key part I was missing a long dic[k] += torch.normal(torch.zeros_like(v), v.std() * 0.01) it was all about me lacking the longer dic[k] part.
Does v = dic[k] mean defining a micro_dic[k] part as larger than it is it could still work for this?
umm.. wow! Could you provide just script file for windows commant line or terminal, to activate it and make everything mathematically right?
Details
Available On (1 platform)
Same model published on other platforms. May have additional downloads or version variants.