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
Hi, I added it as a comment in previous issue, but I think it's nice to raise it as a separate ticket - an issue there was it'd be nice to update diffusers package to newer version, but nowadays I am unable even to run colab demo due to this error.
I wanted to follow up as presented demo colab is not working at all. When downloading StableDiffusion pipeline I got error
TypeError: getattr(): attribute name must be string
When I force to use 0.24, I got error on importing diffusers_interpret: ImportError: cannot import name 'preprocess_mask' from 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint' (/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py)
So I tried to install it with pip again but it downloads diffusers back to 0.3.0
So I can create a pipe for stable diffusion (requires diffusers > 0.4) OR I can use diffusers_interpret (requires 0.3).
Both of them does not work together in demo colab meaning I cannot reproduce your output
The text was updated successfully, but these errors were encountered:
Hi @zakrzewki! Thanks for reaching out.
The problem is in diffusers as you stated, not in diffusers-interpret. diffusers==0.3.0 no longer loads models correctly from HuggingFace Hub.
I took a look and it would take a lot of effort to change this package to now work with a new version of diffusers. I'm can do it, but after some months HuggingFace will change diffusers again, and it will no longer be compatible.
The only real scalable solution is to have them slightly change the package as I mentioned here, and then do the according changes in this package.
If you just want a quick and dirty solution, you cane edit /usr/local/lib/python3.10/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py:
remove line 6 that imports preprocess_mask
create the preprocess_mask in that file:
def preprocess_mask(mask):
mask = mask.convert("L")
w, h = mask.size
w, h = map(lambda x: x - x % 32, (w, h)) # resize to integer multiple of 32
mask = mask.resize((w // 8, h // 8), resample=PIL.Image.NEAREST)
mask = np.array(mask).astype(np.float32) / 255.0
mask = np.tile(mask, (4, 1, 1))
mask = mask[None].transpose(0, 1, 2, 3) # what does this step do?
mask = 1 - mask # repaint white, keep black
mask = torch.from_numpy(mask)
return mask
I don't guarantee that StableDiffusionPipelineExplainer will work 100% though, because the API versions no longer match.
JoaoLages
changed the title
No possibility to run colab demo
diffusers=0.3.0 no longer loads models correctly
Jan 4, 2024
Hi, I added it as a comment in previous issue, but I think it's nice to raise it as a separate ticket - an issue there was it'd be nice to update diffusers package to newer version, but nowadays I am unable even to run colab demo due to this error.
I wanted to follow up as presented demo colab is not working at all. When downloading StableDiffusion pipeline I got error
TypeError: getattr(): attribute name must be string
I found an error about it on SO: https://stackoverflow.com/questions/74687769/typeerror-getattr-attribute-name-must-be-string-in-pytorch-diffusers-how
When I force to use 0.24, I got error on importing diffusers_interpret:
ImportError: cannot import name 'preprocess_mask' from 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint' (/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py)
So I tried to install it with pip again but it downloads diffusers back to 0.3.0
So I can create a pipe for stable diffusion (requires diffusers > 0.4) OR I can use
diffusers_interpret
(requires 0.3).Both of them does not work together in demo colab meaning I cannot reproduce your output
The text was updated successfully, but these errors were encountered: