Comments (8)
I gave a try but I am not sure if implemented correctly. Here are the comparison without and with FreeU.
FreeU OFF | FreeU ON |
---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Above ones are all using artiusV21_v21.safetensors
file. Below comparison switched to v2-1_768-nonema-pruned.safetensors
.
FreeU OFF | FreeU ON |
---|---|
![]() |
![]() |
FreeU definitely won here 😸 .
from stable-diffusion.cpp.
Interesting, I'll see if I can give it some time to at least try if it works.
Bad new:
To implement this, it would be necessary to create the operation for the fourier transform and its inverse in ggml, and that is very difficult.
from stable-diffusion.cpp.
@FSSRepo, @leejet, thanks. There is still quite some work before I can make a PR.
- The changes to
sd.cpp
are relatively trivial but they do require some interface mods (I think it is better to make a switch for FreeU on or off). - The
ggml
mods are more substantial, but still manageable. The problem is the two operators (FFT_FILTER and FREEU_BACKBONE) I added for FreeU are too specific and may not get accepted. I see there are some ggml extensions in sd.cpp but I don't see how cuda backends can be added. I am seeking your advice. - The two additional operators are only implemented for GPU backend and I have to work on their CPU counterparts.
@FSSRepo, I can verify that the two operators are functioning correctly as I have test cases for both. But I don't think I can replicate results with sd-webui or with the implementation from the original author's repository.
from stable-diffusion.cpp.
I gave a try but I am not sure if implemented correctly.
@bssrdf Do you mean in sd.cpp? I checked your fork, and I don't see anything related.
Yes. Please check out add-freeu-support branch of my sd.cpp fork as well as add-freeu-support branch of my ggml fork. Most of the work is done in ggml
. Sorry, code is a bit messy now and I will do a clean up before the PR.
from stable-diffusion.cpp.
I gave a try but I am not sure if implemented correctly.
@bssrdf Do you mean in sd.cpp? I checked your fork, and I don't see anything related.
Yes. Please check out add-freeu-support branch of my sd.cpp fork as well as add-freeu-support branch of my ggml fork. Most of the work is done in
ggml
. Sorry, code is a bit messy now and I will do a clean up before the PR.
Great job! Can you create a PR for both ggml and sd.cpp?
from stable-diffusion.cpp.
FreeU_v2 seems to be a paper update: https://twitter.com/scy994/status/1714499568573039102
from stable-diffusion.cpp.
I gave a try but I am not sure if implemented correctly.
@bssrdf Do you mean in sd.cpp? I checked your fork, and I don't see anything related.
from stable-diffusion.cpp.
@bssrdf Great job, to implement that functionality in sd.cpp for obvious reasons, it must also be compatible with the CPU backend. I don't know much about how to implement the FFT optimally, so I can't help you with that. I'm also interested to see if you could replicate those results with sd-webui or with the implementation from the repository to check if they match or are similar. Additionally, it would be helpful to determine if certain values passed to the Fourier_filter function are the same as those you receive with your implementation.
def Fourier_filter(x, threshold, scale):
# FFT
x_freq = fft.fftn(x, dim=(-2, -1))
x_freq = fft.fftshift(x_freq, dim=(-2, -1))
B, C, H, W = x_freq.shape
mask = torch.ones((B, C, H, W)).cuda()
crow, ccol = H // 2, W //2
mask[..., crow - threshold:crow + threshold, ccol - threshold:ccol + threshold] = scale
x_freq = x_freq * mask
# IFFT
x_freq = fft.ifftshift(x_freq, dim=(-2, -1))
x_filtered = fft.ifftn(x_freq, dim=(-2, -1)).real
from stable-diffusion.cpp.
Related Issues (20)
- rocBLAS error: {...} No such file or directory for GPU arch : gfx1031 HOT 6
- In lora.hpp miss ggml_free(ctx0);
- Will Controlnet be supported in the future? HOT 2
- VAE-Tiling seems to be always enabled in the C-API of 36ec16a HOT 1
- How do specify the upscale size? HOT 2
- to do list remove the winograd conv 2d
- Getting always black image using XL models HOT 2
- Is there a way to use controlnet inpaint?
- Using (UTF-8) accented characters give a segfault
- Are SDXL Controlnet models supported? HOT 1
- "How can I specify a particular GPU?" HOT 4
- Exception at ggml_free when lora is used in the prompt and free_sd_ctx called HOT 1
- add support for StableCascade (würstchen) HOT 2
- Error when use with latest GGML HOT 16
- Not enough space in the context's memory pool with ControlNet HOT 5
- HIP build failing HOT 2
- Error: Unsupported op TIMESTEP_EMBEDDING HOT 5
- SD build static libggml.dylib HOT 2
- service deployment HOT 1
- Artifacts in lower portion of image when generating images of size 1024x1024 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stable-diffusion.cpp.