StableCascade
StableCascade copied to clipboard
Inference not working
I installed the diffusers package as specified on the HF page, and I use this code for simple inference:
import os
import sys
import torch
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
torch.cuda.device_count()
device = 'cpu'
num_images_per_prompt = 2
prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16).to(device)
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=torch.float16).to(device)
It's the same exact code as in the HF page. It breaks with this error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[5], [line 4](vscode-notebook-cell:?execution_count=5&line=4)
[1](vscode-notebook-cell:?execution_count=5&line=1) prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16,
[2](vscode-notebook-cell:?execution_count=5&line=2) low_cpu_mem_usage=False, ignore_mismatched_sizes=True
[3](vscode-notebook-cell:?execution_count=5&line=3) ).to(device)
----> [4](vscode-notebook-cell:?execution_count=5&line=4) decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=torch.float16,
[5](vscode-notebook-cell:?execution_count=5&line=5) low_cpu_mem_usage=False, ignore_mismatched_sizes=True
[6](vscode-notebook-cell:?execution_count=5&line=6) ).to(device)
File [c:\Python310\lib\site-packages\huggingface_hub\utils\_validators.py:118](file:///C:/Python310/lib/site-packages/huggingface_hub/utils/_validators.py:118), in validate_hf_hub_args.<locals>._inner_fn(*args, **kwargs)
[115](file:///C:/Python310/lib/site-packages/huggingface_hub/utils/_validators.py:115) if check_use_auth_token:
[116](file:///C:/Python310/lib/site-packages/huggingface_hub/utils/_validators.py:116) kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
--> [118](file:///C:/Python310/lib/site-packages/huggingface_hub/utils/_validators.py:118) return fn(*args, **kwargs)
File [c:\Python310\lib\site-packages\diffusers\pipelines\pipeline_utils.py:1263](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1263), in DiffusionPipeline.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
[1260](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1260) loaded_sub_model = passed_class_obj[name]
[1261](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1261) else:
[1262](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1262) # load sub model
-> [1263](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1263) loaded_sub_model = load_sub_model(
[1264](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1264) library_name=library_name,
[1265](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1265) class_name=class_name,
[1266](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1266) importable_classes=importable_classes,
[1267](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1267) pipelines=pipelines,
[1268](file:///C:/Python310/lib/site-packages/diffusers/pipelines/pipeline_utils.py:1268) is_pipeline_module=is_pipeline_module,
...
[846](file:///C:/Python310/lib/site-packages/diffusers/models/modeling_utils.py:846) )
RuntimeError: Error(s) in loading state_dict for StableCascadeUnet:
size mismatch for embedding.1.weight: copying a param with shape torch.Size([320, 16, 1, 1]) from checkpoint, the shape in current model is torch.Size([320, 64, 1, 1]).
You may consider adding `ignore_mismatched_sizes=True` in the model `from_pretrained` method.
Nothing helps including the suggestions in the error message.
The diffusers branch is currently broken, will be fixed very soon, meanwhile you can install it from an older commit:
pip3 install git+https://github.com/kashif/diffusers.git@a3dc21385b7386beb3dab3a9845962ede6765887
wait
ye it is hard to make it work
here our developed app check this out : https://github.com/Stability-AI/StableCascade/issues/125