InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: TextualInversion: AttributeError: 'FrozenCLIPEmbedder' object has no attribute 'set_textual_inversion_manager'

Open stefgmz opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

Linux

GPU

cuda

VRAM

No response

What happened?

I wanted to fine-tune and started training with

python3 ./main.py -t     --base ./configs/stable-diffusion/v1-finetune.yaml     --actual_resume scripts/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt     -n my_cat     --gpus 0     --data_root training_data/key     --init_word 'cat'

when I ran into the following problem:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/stefgm/InvokeAI/./main.py:726 in <module>                                                  │
│                                                                                                  │
│   723 │   │   │   config.model.params.personalization_config.params.initializer_words = [opt.i   │
│   724 │   │                                                                                      │
│   725 │   │   if opt.actual_resume:                                                              │
│ ❱ 726 │   │   │   model = load_model_from_config(config, opt.actual_resume)                      │
│   727 │   │   else:                                                                              │
│   728 │   │   │   model = instantiate_from_config(config.model)                                  │
│   729                                                                                            │
│                                                                                                  │
│ /home/stefgm/InvokeAI/./main.py:51 in load_model_from_config                                     │
│                                                                                                  │
│    48 │   pl_sd = torch.load(ckpt, map_location='cpu')                                           │
│    49 │   sd = pl_sd['state_dict']                                                               │
│    50 │   config.model.params.ckpt_path = ckpt                                                   │
│ ❱  51 │   model = instantiate_from_config(config.model)                                          │
│    52 │   m, u = model.load_state_dict(sd, strict=False)                                         │
│    53 │   if len(m) > 0 and verbose:                                                             │
│    54 │   │   print('missing keys:')                                                             │
│                                                                                                  │
│ /home/stefgm/InvokeAI/ldm/util.py:92 in instantiate_from_config                                  │
│                                                                                                  │
│    89 │   │   elif config == '__is_unconditional__':                                             │
│    90 │   │   │   return None                                                                    │
│    91 │   │   raise KeyError('Expected key `target` to instantiate.')                            │
│ ❱  92 │   return get_obj_from_str(config['target'])(                                             │
│    93 │   │   **config.get('params', dict()), **kwargs                                           │
│    94 │   )                                                                                      │
│    95                                                                                            │
│                                                                                                  │
│ /home/stefgm/InvokeAI/ldm/models/diffusion/ddpm.py:688 in __init__                               │
│                                                                                                  │
│    685 │   │   │   full_precision = True                                                         │
│    686 │   │   )                                                                                 │
│    687 │   │   # this circular component dependency is gross and bad, needs to be rethought      │
│ ❱  688 │   │   self.cond_stage_model.set_textual_inversion_manager(self.textual_inversion_manag  │
│    689 │   │                                                                                     │
│    690 │   │   self.emb_ckpt_counter = 0                                                         │
│    691                                                                                           │
│                                                                                                  │
│ /opt/anaconda3/envs/invokeai/lib/python3.9/site-packages/torch/nn/modules/module.py:1207 in      │
│ __getattr__                                                                                      │
│                                                                                                  │
│   1204 │   │   │   modules = self.__dict__['_modules']                                           │
│   1205 │   │   │   if name in modules:                                                           │
│   1206 │   │   │   │   return modules[name]                                                      │
│ ❱ 1207 │   │   raise AttributeError("'{}' object has no attribute '{}'".format(                  │
│   1208 │   │   │   type(self).__name__, name))                                                   │
│   1209 │                                                                                         │
│   1210 │   def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'FrozenCLIPEmbedder' object has no attribute 'set_textual_inversion_manager'

Any ideas what might be wrong?

Screenshots

No response

Additional context

No response

Contact Details

No response

stefgmz avatar Jan 24 '23 17:01 stefgmz

We're about to completely phase out main.py and introduce a new and much less buggy version of textual inversion. If you want a preview, wait a day or two for our release candidate.

lstein avatar Jan 30 '23 02:01 lstein

There has been no activity in this issue for 14 days. If this issue is still being experienced, please reply with an updated confirmation that the issue is still being experienced with the latest release.

github-actions[bot] avatar Mar 12 '23 06:03 github-actions[bot]

raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'FrozenCLIPEmbedder' object has no attribute 'wrapped

got also this issue

hoodady avatar May 17 '23 07:05 hoodady