painebenjamin / app.enfugue.ai

ENFUGUE is an open-source web app for making studio-grade images and video using generative AI.
GNU General Public License v3.0
686 stars 65 forks source link

Lora Filepath Restrictions/Issue #85

Closed RandomKaos999 closed 1 year ago

RandomKaos999 commented 1 year ago

Hi, me again, this time with a potential Lora/filesystem issue.

I have a folder setup H:\AIStuff\Generations\Lora - contains subfolders etc with Lora's I tinker with. e.g H:\AIStuff\Generations\Lora\People\<name>\optimiser\<different folder name>\*.safetensor

If I add the folder H:\AIStuff\Generations\Lora to Enfugue in the "Installation settings", it does indeed list them on the software, however, when going to run inference:

2023-10-05 16:19:25,629 [enfugue] DEBUG (manager.py:2369) Adding LoRA H:\AIStuff\Generations\Lora\People\test05102023.safetensors to pipeline with weight 1.0 2023-10-05 16:19:25,971 [enfugue] ERROR (process.py:381) Received error builtins.FileNotFoundError: No such file or directory: "H:\AIStuff\Generations\Lora\People\test05102023.safetensors"

However, the actual full path would of been H:\AIStuff\Generations\Lora\People\CurrentTest\DAdaptation\ModelWeight0.4\test05102023.safetensors

Edit: This was on 0.2.3, ill download 0.2.4 and try that just to confirm it on there too.

painebenjamin commented 1 year ago

Hello! Yes, please it give a shot on 0.2.4. This should explicitly be fixed in that version.

RandomKaos999 commented 1 year ago

Sadly, still an issue 0.2.4, freshly extracted just now to a new folder. I also cleared C:\Users\.cache as well.

2023-10-05 16:47:26,678 [enfugue] ERROR (engine.py:277) Traceback (most recent call last):
  File "enfugue\diffusion\process.py", line 375, in run
    response["result"] = self.execute_diffusion_plan(
  File "enfugue\diffusion\process.py", line 113, in execute_diffusion_plan
    return plan.execute(
  File "enfugue\diffusion\plan.py", line 930, in execute
    images, nsfw = self.execute_nodes(
  File "enfugue\diffusion\plan.py", line 1254, in execute_nodes
    result = node.execute(
  File "enfugue\diffusion\plan.py", line 786, in execute
    return self.step.execute(pipeline, **kwargs)
  File "enfugue\diffusion\plan.py", line 640, in execute
    result = pipeline(**invocation_kwargs)
  File "enfugue\diffusion\manager.py", line 3439, in __call__
    pipe = self.pipeline
  File "enfugue\diffusion\manager.py", line 2515, in pipeline
    pipeline.load_lora_weights(lora, multiplier=weight)
  File "enfugue\diffusion\pipeline.py", line 926, in load_lora_weights
    return self.load_safetensors_lora_weights(
  File "enfugue\diffusion\pipeline.py", line 987, in load_safetensors_lora_weights
    state_dict = safetensors.torch.load_file(pretrained_model_name_or_path_or_dict, device="cpu")
  File "safetensors\torch.py", line 308, in load_file
    with safe_open(filename, framework="pt", device=device) as f:
FileNotFoundError: No such file or directory: "
2023-10-05 16:47:26,678 [enfugue] ERROR (engine.py:277) Traceback (most recent call last):
  File "enfugue\diffusion\process.py", line 375, in run
    response["result"] = self.execute_diffusion_plan(
  File "enfugue\diffusion\process.py", line 113, in execute_diffusion_plan
    return plan.execute(
  File "enfugue\diffusion\plan.py", line 930, in execute
    images, nsfw = self.execute_nodes(
  File "enfugue\diffusion\plan.py", line 1254, in execute_nodes
    result = node.execute(
  File "enfugue\diffusion\plan.py", line 786, in execute
    return self.step.execute(pipeline, **kwargs)
  File "enfugue\diffusion\plan.py", line 640, in execute
    result = pipeline(**invocation_kwargs)
  File "enfugue\diffusion\manager.py", line 3439, in __call__
    pipe = self.pipeline
  File "enfugue\diffusion\manager.py", line 2515, in pipeline
    pipeline.load_lora_weights(lora, multiplier=weight)
  File "enfugue\diffusion\pipeline.py", line 926, in load_lora_weights
    return self.load_safetensors_lora_weights(
  File "enfugue\diffusion\pipeline.py", line 987, in load_safetensors_lora_weights
    state_dict = safetensors.torch.load_file(pretrained_model_name_or_path_or_dict, device="cpu")
  File "safetensors\torch.py", line 308, in load_file
    with safe_open(filename, framework="pt", device=device) as f:
FileNotFoundError: No such file or directory: "H:\\AIStuff\\Generations\\Lora\\test05102023.safetensors"

This was with a pre-configured model. However, if I choose the checkpoint and add a lora, on the canvas part, it works fine from there. It seems specifically pre-configured models.

screenshot of the installation settings lora part: image

painebenjamin commented 1 year ago

Hello @RandomKaos999!

Thank you for reporting this. Since this was an essential fix for the launch on RunDiffusion, I scrambled and snuck in a fix.

I believe you're using the portable binary - I'm sorry to ask you to download yet another thing, but if you could, please re-download the 0.2.4 release to get the fix. If you're managing your own environment, you can run pip install --upgrade enfugue or pip install enfugue==0.2.4.post1.

RandomKaos999 commented 1 year ago

Re-downloaded and tested, confirmed now working properly with pre-configured models :)