Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in Lora : UnboundLocalError: local variable '_tmp' referenced before assignment` #21

Open
c0ffymachyne opened this issue Feb 10, 2024 · 2 comments

Comments

@c0ffymachyne
Copy link

c0ffymachyne commented Feb 10, 2024

Hello, when running the inference code I am getting this error. Is there anything I am missing ?
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
/media/MotionDirector/MotionDirector_train.py:1048 in

1045 parser = argparse.ArgumentParser()
1046 parser.add_argument("--config", type=str, default='configs/config_single_video.yaml'
1047 args = parser.parse_args()
❱ 1048 main(**OmegaConf.load(args.config))
1049

/media/MotionDirector/MotionDirector_train.py:607 in main

604       # one temporal lora                                                               
605       lora_manager_temporal = LoraHandler(use_unet_lora=use_unet_lora, unet_replace_mo  
606                                                                                         

❱ 607 unet_lora_params_temporal, unet_negation_temporal = lora_manager_temporal.add_lo
608 use_unet_lora, unet, lora_manager_temporal.unet_replace_modules, lora_unet_d
609 lora_path + '/temporal/lora/', r=lora_rank)
610

/media//MotionDirector/utils/lora_handler.py:214 in
add_lora_to_model

211 )
212
213 if use_lora:
❱ 214 params, negation, is_injection_hybrid = self.do_lora_injection(
215 model,
216 replace_modules,
217 bias=self.lora_bias,

/media/MotionDirector/utils/lora_handler.py:183 in
do_lora_injection

180 is_injection_hybrid = True
181 injector_args = lora_loader_args
182
❱ 183 params, negation = self.lora_injector(**injector_args) # inject_trainable_l
184 for _up, _down in extract_lora_ups_down(
185 model,
186 target_replace_module=REPLACE_MODULES):

/media/MotionDirector/utils/lora.py:532 in
inject_trainable_lora_extended

529                if bias is not None:                                                  
530                   _tmp.conv.bias = bias                                             
531             # switch the module                                                       

❱ 532 _tmp.to(_child_module.weight.device).to(_child_module.weight.dtype)
533 if bias is not None:
534 _tmp.to(_child_module.bias.device).to(_child_module.bias.dtype)
535
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnboundLocalError: local variable '_tmp' referenced before assignment

@ruizhaocv
Copy link
Collaborator

Hi. What is your diffuser version?

@sam-motamed
Copy link

This indeed seems to be a diffusers version mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants