NeuralNotW0rk / LoRAW

Flexible LoRA Implementation to use with stable-audio-tools
MIT License
39 stars 3 forks source link

TypeError: Expected state_dict to be dict-like, got <class 'str'>. #9

Closed GoombaProgrammer closed 3 months ago

GoombaProgrammer commented 3 months ago

When I load my trained LoRA, it gives the following error:

  File "/mnt/e/tts/ok/stable-audio-tools-main/run_gradio.py", line 33, in <module>
    main(args)
  File "/mnt/e/tts/ok/stable-audio-tools-main/run_gradio.py", line 10, in main
    interface = create_ui(
  File "/mnt/e/tts/ok/stable-audio-tools-main/interface/gradio.py", line 681, in create_ui
    _, model_config = load_model(model_config, ckpt_path, lora_ckpt_path=lora_ckpt_path, pretrained_name=pretrained_name, pretransform_ckpt_path=pretransform_ckpt_path, model_half=model_half, device=device)   
  File "/mnt/e/tts/ok/stable-audio-tools-main/interface/gradio.py", line 64, in load_model
    lora.load_weights(lora_ckpt_path)
  File "/mnt/e/tts/ok/stable-audio-tools-main/loraw/network.py", line 218, in load_weights
    info = self.residual_modules.load_state_dict(residual_weights, False)
  File "/home/mmp/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2103, in load_state_dict
    raise TypeError(f"Expected state_dict to be dict-like, got {type(state_dict)}.")
TypeError: Expected state_dict to be dict-like, got <class 'str'>.

This happens at the newest commit.

NeuralNotW0rk commented 3 months ago

My mistake, I changed LoRAWrapper.load_weights() to take a state_dict instead of file path and forgot to update the gradio. I have pushed a fix.