Git Product home page Git Product logo

Comments (2)

JoaoLages avatar JoaoLages commented on May 18, 2024

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.

from diffusers-interpret.

JoaoLages avatar JoaoLages commented on May 18, 2024

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.

from diffusers-interpret.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.