Code Monkey home page Code Monkey logo

Comments (6)

strint avatar strint commented on August 23, 2024 1

Please let me know if this feature is ever implemented. Thanks

We provide an offline-compile mode to reduce online-compile time for scenarios where the input shapes of online inference is limited. Hope this will help: https://github.com/Oneflow-Inc/diffusers/wiki/How-to-Run-OneFlow-Stable-Diffusion#optimization-for-multi-resolution-picture

@chavinlo

from onediff.

strint avatar strint commented on August 23, 2024

Compiling a dynamic shape graph is not supported right now. We use some optimization skills which are related to static input shape:

  • memory static allocation;
  • constant folding;

Have you met some problems with static shapes?

from onediff.

chavinlo avatar chavinlo commented on August 23, 2024

Have you met some problems with static shapes?

No, but we are building a service that plans to offer dynamic resolutions.
I was thinking of compiling it for multiple resolutions, but that would take up vram space

from onediff.

chavinlo avatar chavinlo commented on August 23, 2024

Please let me know if this feature is ever implemented. Thanks

from onediff.

chavinlo avatar chavinlo commented on August 23, 2024

Please let me know if this feature is ever implemented. Thanks

We provide an offline-compile mode to reduce online-compile time for scenarios where the input shapes of online inference is limited. Hope this will help: https://github.com/Oneflow-Inc/diffusers/wiki/How-to-Run-OneFlow-Stable-Diffusion#optimization-for-multi-resolution-picture

@chavinlo

Thanks. First I call pipe.enable_graph_share_mem(), then run inference on the resolutions I want, and the graph should be ready for those resolutions right?

pipe.enable_graph_share_mem()

prompt = "a photo of an astronaut riding a horse on mars, red sky, (green sky:1.5)"
with torch.autocast("cuda"):
    images = pipe(prompt, height=1024).images
    images = pipe(prompt, height=768).images
    images = pipe(prompt, height=512).images
    images = pipe(prompt, height=256).images

sorting the input shape from large to small to trigger graph compilation

I see that it takes 1 second to load when it changes resolution:

    images = pipe(prompt, height=256).images
    images = pipe(prompt, height=256).images
    images = pipe(prompt, height=512).images
    images = pipe(prompt, height=512).images
    images = pipe(prompt, height=768).images
    images = pipe(prompt, height=768).images
    images = pipe(prompt, height=1024).images
    images = pipe(prompt, height=1024).images
    images = pipe(prompt, height=768).images
    images = pipe(prompt, height=768).images
    images = pipe(prompt, height=512).images
    images = pipe(prompt, height=512).images
    images = pipe(prompt, height=256).images
    images = pipe(prompt, height=256).images

Is there anyway to speed this up? or maybe mantain all of them active? I don't mind having to use more vram.

from onediff.

strint avatar strint commented on August 23, 2024

You can run and read this test to be familiar with these two features: https://github.com/Oneflow-Inc/diffusers/blob/oneflow-fork/tests/test_pipelines_oneflow_graph_load.py

@chavinlo

from onediff.

Related Issues (20)

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.