Zeju1997 / oft

Official implementation of "Controlling Text-to-Image Diffusion by Orthogonal Finetuning".
https://oft.wyliu.com/
MIT License
280 stars 14 forks source link

What is the project function for? #12

Closed yukistavailable closed 11 months ago

yukistavailable commented 11 months ago

https://github.com/Zeju1997/oft/blob/84cebb965df69781e3d9c3c875f5980b421eaf24/oft-db/oft_utils/attention_processor.py#L393

Hi, thank you for such an interesting work! I am reading the code and a bit confused about the project function.

The function is likely designed to ensure that a given matrix R stays close to the zero matrix within a specified tolerance. I guess this function corresponds the COFT formulation $| Q - 0 | \leq \epsilon^{\prime}$. Is my understanding correct?

YuxuanSnow commented 11 months ago

Hi, thanks for the question. The project function is used in COFT. If the R is too large, then project R back to the boundary constraint value (eps).