Stability-AI / StableCascade

Official Code for Stable Cascade
MIT License
6.53k stars 530 forks source link

AttributeError in text_to_image.ipynb #78

Open starkdg opened 7 months ago

starkdg commented 7 months ago

When running the text_to_image.ipynb, I get an Attribute Error.

AttributeError Traceback (most recent call last)

in () 1 # SETUP MODELS & DATA 2 extras = core.setup_extras_pre() ----> 3 models = core.setup_models(extras) 4 models.generator.eval().requires_grad_(False) 5 print("STAGE C READY") /gdrive/MyDrive/StableCascade/train/train_c.py in setup_models(self, extras) 161 generator.load_state_dict(load_or_fail(self.config.generator_checkpoint_path)) 162 else: --> 163 for param_name, param in load_or_fail(self.config.generator_checkpoint_path).items(): 164 set_module_tensor_to_device(generator, param_name, "cpu", value=param) 165 generator = generator.to(dtype).to(self.device) AttributeError: 'NoneType' object has no attribute 'items'
atomassoni commented 7 months ago

this also happens in controlnet.ipynb


TypeError                                 Traceback (most recent call last)
[<ipython-input-12-af8515e91e5e>](https://localhost:8080/#) in <cell line: 11>()
      9 extras = core.setup_extras_pre()
     10 print(extras)
---> 11 models = core.setup_models(extras)
     12 models.generator.eval().requires_grad_(False)
     13 print("CONTROLNET READY")

[/content/StableCascade/train/train_c.py](https://localhost:8080/#) in setup_models(self, extras)
    126         effnet = EfficientNetEncoder()
    127         effnet_checkpoint = load_or_fail(self.config.effnet_checkpoint_path)
--> 128         effnet.load_state_dict(effnet_checkpoint if 'state_dict' not in effnet_checkpoint else effnet_checkpoint['state_dict'])
    129         effnet.eval().requires_grad_(False).to(self.device)
    130         del effnet_checkpoint

TypeError: argument of type 'NoneType' is not iterable
danielstrenger commented 7 months ago

I encounter the same problem and I guess, it arises from the model versions that we downloaded. I downloaded the float32 models (did you as well?), but in the file stage_3_3b.yaml, which is used in the notebook, there is the line generator_checkpoint_path: models/stage_c_bf16.safetensors which references a file that does not exist (because I downloaded the float32 version). I have tried to change the above line to generator_checkpoint_path: models/stage_c.safetensors which would now reference the correct file, but now the Jupyter kernel keeps dying when I try to execute the code cell for loading the models. (a similar problem should also arise for stage b)

dome272 commented 7 months ago

This error indicates that the required model checkpoint is not existing. Have you downloaded all the checkpoints and put them to the correct path as indicated by the config files?

Pranshu8694 commented 6 months ago

I tried downloading all checkpoints using the bash file, still I am facing the same issue.

kenning commented 6 months ago

for controlnet, it doesn't seem to work unless you download both of the big bfloat16 models. i hope that helps