Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'is_inpainting_task': 'inpainting' in model.name_or_path #26

Open
crapthings opened this issue May 19, 2024 · 5 comments
Open

'is_inpainting_task': 'inpainting' in model.name_or_path #26

crapthings opened this issue May 19, 2024 · 5 comments

Comments

@crapthings
Copy link

Traceback (most recent call last):
File "/home/zznet/workspace/ai-pipe/prod-ai-pipe-replace-model/runpod_app.py", line 14, in
from pipe import text2img, getText2imgPipe, set_sampler, compel
File "/home/zznet/workspace/ai-pipe/prod-ai-pipe-replace-model/pipe.py", line 34, in
apply_hidiffusion(text2imgPipe)
File "/home/zznet/.local/lib/python3.10/site-packages/hidiffusion/hidiffusion.py", line 1959, in apply_hidiffusion
'is_inpainting_task': 'inpainting' in model.name_or_path,
TypeError: argument of type 'NoneType' is not iterable

@ShenZhang-Shin
Copy link
Collaborator

Do you run inpainting following the code in readme? Or you use your own code

@minipuding
Copy link

I have the same problem

@ShenZhang-Shin
Copy link
Collaborator

You can check whether model is NoneType. Or can you show your code?

@iwr-redmond
Copy link

iwr-redmond commented Aug 2, 2024

Same error here.

Code snippets:

base_model_id='/var/storage/checkpoints/softrealistic_v187.safetensors'

self.pipe = StableDiffusionPipeline.from_single_file(
                        base_model_id,
                        torch_dtype=self.type_model_precision,
                    )
                    class_name = "StableDiffusionPipeline"

apply_hidiffusion(self.pipe)

diffusers==0.29.0

@JohnnyStreet
Copy link

JohnnyStreet commented Sep 21, 2024

A solution was already posted here but never added to the repo #3

EDIT: It looks like the codebase has changed where this solution was applied before. I'll try to update and submit a PR today.

from diffusers.pipelines import auto_pipeline
...
def apply_hidiffusion(
        model: torch.nn.Module,
        apply_raunet: bool = True,
        apply_window_attn: bool = True,        
        is_playground = False):
        ...
        'is_inpainting_task': model.__class__ in auto_pipeline.AUTO_INPAINT_PIPELINES_MAPPING.values(), 
        'is_playground': is_playground,

Additionally, it seems to be expecting the pipeline to have a _num_timesteps attribute. Since there was previously a hard-coded value of 50, I assume this is num_inference_steps. I was able to solve this by doing the following before inference:

setattr(image_pipeline, "_num_timesteps", request.num_inference_steps)

After implementing these changes it is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants