Code Monkey home page Code Monkey logo

Comments (4)

0xdevalias avatar 0xdevalias commented on May 25, 2024 2

I made a simple colab example just now, you can try it out here: paint-with-words colab

Originally posted by @shreydan in #4 (comment)

You can confirm the above hf_model_path change on the colab mentioned here by editing the cell that has the img = paint_with_words( (first cell after the 'Run Model' heading)

We can also explicitly set the seed parameter here as well, to make comparisons between the 2 models easier.

Original version using SD v1.4

image
image

New version using SD v1.5

image
image

from paint-with-words-sd.

0xdevalias avatar 0xdevalias commented on May 25, 2024

This is documented in the README already:


You can see that pww_load_tools takes a hf_model_path and/or local_model_path here:

def pww_load_tools(
device: str = "cuda:0",
scheduler_type=LMSDiscreteScheduler,
local_model_path: Optional[str] = None,
hf_model_path: Optional[str] = None,

pww_load_tools is called by paint_with_words, which can also be passed hf_model_path and/or local_model_path, with hf_model_path defaulting to "CompVis/stable-diffusion-v1-4"

def paint_with_words(
color_context: Dict[Tuple[int, int, int], str] = {},
color_map_image: Optional[Image.Image] = None,
input_prompt: str = "",
num_inference_steps: int = 30,
guidance_scale: float = 7.5,
seed: int = 0,
scheduler_type=LMSDiscreteScheduler,
device: str = "cuda:0",
weight_function: Callable = lambda w, sigma, qk: 0.1
* w
* math.log(sigma + 1)
* qk.max(),
local_model_path: Optional[str] = None,
hf_model_path: Optional[str] = "CompVis/stable-diffusion-v1-4",
preloaded_utils: Optional[Tuple] = None,
unconditional_input_prompt: str = "",
):
vae, unet, text_encoder, tokenizer, scheduler = (
pww_load_tools(
device,
scheduler_type,
local_model_path=local_model_path,
hf_model_path=hf_model_path,
)

So it looks like it may be even easier than the README suggests, and you should just be able to pass "runwayml/stable-diffusion-v1-5" directly into the hf_model_path parameter of paint_with_words as it's called in the 'Basic Usage' section:

Something like this would presumably work:

img = paint_with_words(
    color_context=color_context,
    color_map_image=color_map_image,
    input_prompt=input_prompt,
    num_inference_steps=30,
    guidance_scale=7.5,
    device="cuda:0",
+   hf_model_path="runwayml/stable-diffusion-v1-5"
)

from paint-with-words-sd.

hiss-remi avatar hiss-remi commented on May 25, 2024

You can see that pww_load_tools takes a hf_model_path and/or local_model_path here:

One advantage of this method that you can also change the scheduler, which might be desirable for performance or quality issues. (I found recently that the model I'm using often has blatant graphical issues even with a large step count on LMS, but EulerAncestralDiscreteScheduler or EulerDiscreteScheduler do much better. Just don't forget to import your scheduler of choice from diffusers. (Something the example currently doesn't show.)

from paint-with-words-sd.

cloneofsimo avatar cloneofsimo commented on May 25, 2024

Nice note @hiss-remi , ill add this feature as well.

from paint-with-words-sd.

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.