StableCascade icon indicating copy to clipboard operation
StableCascade copied to clipboard

AttributeError in text_to_image.ipynb

Open starkdg opened this issue 1 year ago • 5 comments

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

AttributeError Traceback (most recent call last) in <cell line: 3>() 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'

starkdg avatar Feb 19 '24 18:02 starkdg

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

atomassoni avatar Feb 21 '24 01:02 atomassoni

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)

danielstrenger avatar Feb 25 '24 09:02 danielstrenger

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?

dome272 avatar Feb 27 '24 11:02 dome272

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

Pranshu8694 avatar Mar 18 '24 11:03 Pranshu8694

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

kenning avatar Mar 19 '24 23:03 kenning