justinpinkney / stable-diffusion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect `freeze` method in `FrozenCLIPImageEmbedder` causes `AttributeError`

mhnoni opened this issue · comments

commented

Hi, so I spent 3 days and I could pass the below error, I assume the requirements has conflict, so please fix it.


making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
  File "P:\ai\stable-diffusion-main\scripts\gradio_variations.py", line 143, in <module>
    fire.Fire(run_demo)
  File "C:\ProgramData\Miniconda3\envs\dsd\lib\site-packages\fire\core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "C:\ProgramData\Miniconda3\envs\dsd\lib\site-packages\fire\core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "C:\ProgramData\Miniconda3\envs\dsd\lib\site-packages\fire\core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "P:\ai\stable-diffusion-main\scripts\gradio_variations.py", line 110, in run_demo
    model = load_model_from_config(config, ckpt, device=device)
  File "p:\ai\stable-diffusion-main\scripts\image_variations.py", line 26, in load_model_from_config
    model = instantiate_from_config(config.model)
  File "p:\ai\stable-diffusion-main\ldm\util.py", line 79, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "p:\ai\stable-diffusion-main\ldm\models\diffusion\ddpm.py", line 523, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "p:\ai\stable-diffusion-main\ldm\models\diffusion\ddpm.py", line 581, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "p:\ai\stable-diffusion-main\ldm\util.py", line 79, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "p:\ai\stable-diffusion-main\ldm\modules\encoders\modules.py", line 209, in __init__
    self.freeze()
  File "p:\ai\stable-diffusion-main\ldm\modules\encoders\modules.py", line 212, in freeze
    self.transformer = self.transformer.eval()
  File "C:\ProgramData\Miniconda3\envs\dsd\lib\site-packages\torch\nn\modules\module.py", line 1185, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'FrozenCLIPImageEmbedder' object has no attribute 'transformer'

The environment.yaml was inherited from the base repo, I've deleted it. I'll update the requirements, but for the moment see:

#15 (comment)

commented

The environment.yaml was inherited from the base repo, I've deleted it. I'll update the requirements, but for the moment see:

#15 (comment)

Thanks, would you please mention the python version on your side too so we can setup the conda env?

I'm so bummed, yet another thing I try doing in Linux, dead-ended face-first into a cryptic error message (exactly as above), at the mercy of the developer as the only person that can decode the cryptic string of related packages that fail to mesh together.

It's a perfectly clean install of Ubuntu, having just brought up Torch to a point it can actually function (involved removing the default version of PyTorch and installing a CUDA 11.6 version of it).

Simply editing environment.yaml (as above) had no effect - pretty sure that info is read earlier in the setup process, and editing it after setup won't change/fix anything. My versions match those, though (torch-1.12.1+cu116, torchvision-0.13.1+cu116, and CUDA 11.7 - but I'm guessing newer is better? How would I even downgrade that?).

@FalconFour @mhnoni All your talk of requirements issues totally threw me off the scent! This was just a plain old bug, has nothing to do with requirements of anything.

Was from the freeze method I'd added during some other work. I removed this and hopefully this works again now.

commented

Thanks a lot!