justinpinkney / stable-diffusion

MIT License
1.45k stars 266 forks source link

AttributeError: module 'keras.backend' has no attribute 'is_tensor' #42

Closed drewburns closed 2 years ago

drewburns commented 2 years ago

Hey there, I am following the Pokemon tutorial posted by Justin - with the same dataset and code on Lambda Labs with a 1x A100 (40 GB SXM4).

I download the checkpoint sd-v1-4-full-ema.ckpt into the correct folder and run

python main.py -t --base configs/stable-diffusion/pokemon.yaml --gpus 0, --scale_lr False --num_nodes 1 --check_val_every_n_epoch 10 --finetune_from models/ldm/stable-diffusion-v1/sd-v1-4-full-ema.ckpt

I run into an issue Any idea why it is failing here? I install the requirements.py so the versions should all be up to date?

It appears to be this line: image_transforms.extend([transforms.ToTensor(), transforms.Lambda(lambda x: rearrange(x * 2. - 1., 'c h w -> h w c'))])


  rank_zero_warn(
Epoch 0:   0%|                                                                                          | 0/209 [00:00<00:00, 5907.47it/s]Summoning checkpoint.
Traceback (most recent call last):
  File "main.py", line 901, in <module>
    trainer.fit(model, data)

 File "/home/ubuntu/stable-diffusion/ldm/data/simple.py", line 137, in <lambda>
    transforms.Lambda(lambda x: rearrange(x * 2. - 1., 'c h w -> h w c'))])
.....
AttributeError: module 'keras.backend' has no attribute 'is_tensor' ```
drewburns commented 2 years ago

Works with pip install --upgrade keras