You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is caused by an extension, but I believe it is caused by a bug in the webui
The issue exists in the current version of the webui
The issue has not been reported before recently
The issue has been reported before but has not been fixed yet
What happened?
I noticed that the "CodeFormer weight" slider on the Settings tab had no effect on the resulting restored faces. However, on the huggingface space of CodeFormer, the corresponding "Codeformer_Fidelity" slider clearly did have an effect on the output.
I found that the main difference between the code of that huggingface space and implementation of this web UI is how the codeformer model is loaded. The huggingspace implementation uses a local architecture registry to instantiate the model, while this webui relies on spandrel to determine the correct network architecture and load the model. This is where the bug originates:
The forward method of the huggingface codeformer archicture registry python file uses the keyword argument w to control the "Codeformer_Fidelity", while the corresponding spandrel codeformer architecture python file uses a keyword argument named weight instead.
However, in the modules/codeformer_model implementation, forward is called with the kwarg w, which is ignored and leads to the default value of 0.5 being used every time.
Steps to reproduce the problem
Generate a picture of a person facing the camera
Go to settings and check "Restore faces"
Select "CodeFormer" as the Face restoration model
Set the CodeFormer weight to 0
Re-generate the first picture using the same seed
Set the CodeFormer weight to 1
Re-generate the first picture using the same seed
Compare the pictures of step 5 and 7 and notice that they are identical
What should have happened?
In the forward call of the codeformer model in modules/codeformer_model , the keyword argument w should be changed toweight, so that the "CodeFormer weight" slider actually has an effect on the restored faces.
Here is the line after I changed it:
Checklist
What happened?
I noticed that the "CodeFormer weight" slider on the Settings tab had no effect on the resulting restored faces. However, on the huggingface space of CodeFormer, the corresponding "Codeformer_Fidelity" slider clearly did have an effect on the output.
I found that the main difference between the code of that huggingface space and implementation of this web UI is how the codeformer model is loaded. The huggingspace implementation uses a local architecture registry to instantiate the model, while this webui relies on spandrel to determine the correct network architecture and load the model. This is where the bug originates:
The
forward
method of the huggingface codeformer archicture registry python file uses the keyword argumentw
to control the "Codeformer_Fidelity", while the corresponding spandrel codeformer architecture python file uses a keyword argument namedweight
instead.However, in the modules/codeformer_model implementation,
forward
is called with the kwargw
, which is ignored and leads to the default value of 0.5 being used every time.Steps to reproduce the problem
What should have happened?
In the
forward
call of the codeformer model in modules/codeformer_model , the keyword argumentw
should be changed toweight
, so that the "CodeFormer weight" slider actually has an effect on the restored faces.Here is the line after I changed it:
What browsers do you use to access the UI ?
No response
Sysinfo
Console logs
Additional information
No response
The text was updated successfully, but these errors were encountered: