NVIDIA / Stable-Diffusion-WebUI-TensorRT

TensorRT Extension for Stable Diffusion Web UI
MIT License
1.92k stars 146 forks source link

The Lora model cannot be converted if the name has spaces #297

Open Yomisana opened 8 months ago

Yomisana commented 8 months ago

Lora models cannot be converted if their names have spaces. I don’t know if this problem will occur on the checkpoint model, but I am sure that there will be an error in the Lora model.

Lora name: example lora 1.5.safetensors Web show: No LoRA model found for example

it will fixed? thanks 😄 btw "if cannot be converted if the name has spaces" fixed will have" Batch Lora & checkpoint conversion"?

seems #253 have solution but will fixed in main branch?

Terroosh commented 8 months ago

Periods in the name also cause the same thing such as TestLoraV1.5.safetensors

Yomisana commented 8 months ago

Periods in the name also cause the same thing such as TestLoraV1.5.safetensors

yeah you right. so pull request of my repo have fix this too

Terroosh commented 8 months ago

Periods in the name also cause the same thing such as TestLoraV1.5.safetensors

yeah you right. so pull request of my repo have fix this too

I tried your pull request. It does fix spaces in lora names but it does not fix periods in lora names. It errors with "Lora not found" and a 1 kb file is generated in Unet-trt.

Yomisana commented 8 months ago

Periods in the name also cause the same thing such as TestLoraV1.5.safetensors

yeah you right. so pull request of my repo have fix this too

I tried your pull request. It does fix spaces in lora names but it does not fix periods in lora names. It errors with "Lora not found" and a 1 kb file is generated in Unet-trt.

Have any file name, screenshot of webui page and browse F12 dev console page? let me check you tell me about this file name had dot in file name will get error

Terroosh commented 8 months ago

Periods in the name also cause the same thing such as TestLoraV1.5.safetensors

yeah you right. so pull request of my repo have fix this too

I tried your pull request. It does fix spaces in lora names but it does not fix periods in lora names. It errors with "Lora not found" and a 1 kb file is generated in Unet-trt.

Have any file name, screenshot of webui page and browse F12 dev console page? let me check you tell me about this file name had dot in file name will get error

Here's an example: Checkpoint: https://civitai.com/models/46422 Lora: https://civitai.com/models/353746

The Lora file name is girllikeretrobarbershop.safetensors If we export this with TensorRT it exports normally

Exporting girllikeretrobarbershop to TensorRT using - Batch Size: 1-1-1
Height: 512-512-512
Width: 512-512-512
Token Count: 77-77-77
Disabling attention optimization
[I] Loading weights map: K:\SD A1111\models\Unet-trt\juggernaut_reborn_weights_map.json

But if we change the file name to girllikeretrobarbershopV1.1.safetensors it no longer exports and creates a 1kb girllikeretrobarbershopV1.1.lora file:

Exporting girllikeretrobarbershopV1.1 to TensorRT using - Batch Size: 1-1-1
Height: 512-512-512
Width: 512-512-512
Token Count: 77-77-77
Disabling attention optimization
[I] Loading weights map: K:\SD A1111\models\Unet-trt\juggernaut_reborn_weights_map.json

Lora not found: girllikeretrobarbershopV1
Yomisana commented 8 months ago

girllikeretrobarbershopV1.1

TensorRT export name is girllikeretrobarbershopV1.1

But seems your prompt Lora name like <lora:girllikeretrobarbershopV1:1>so you should try use <lora:girllikeretrobarbershopV1.1:1> it may works.

1 kb file is generated in Unet-trt

I guess is lora itself issue I pretty sure not the fix lora space to make it 1Kb and maybe TensorRT it export just 1kb...etc IDK sorry this part need someone really know about it will tell you why file export 1kb(1kb output lora it working fine tho :P).

Yomisana commented 8 months ago

I just found the settings it will make you better use this ext, use file name to input your lora. chrome_1uuzbvCkn8

Terroosh commented 8 months ago

I just found the settings it will make you better use this ext, use file name to input your lora.

Unfortunately that doesn't work. Since there's a period in the filename the lora never gets properly converted.

explorer_vIgVz5GwMc

You can see in the above picture that the lora without a period in the filename gets properly converted to a 1.1 GB file where as the lora with a period does not get converted properly and is a 1kb file.

Yomisana commented 8 months ago

I just found the settings it will make you better use this ext, use file name to input your lora.

Unfortunately that doesn't work. Since there's a period in the filename the lora never gets properly converted.

explorer_vIgVz5GwMc

You can see in the above picture that the lora without a period in the filename gets properly converted to a 1.1 GB file where as the lora with a period does not get converted properly and is a 1kb file.

oh yeah I see what you mean now... this issue need this repo to change func input loraname because export input this func loraname may do pre split abot "dot" so it out of my range :_

So the best way now is change the file name and webui setting lora use filename prompt, and wait dev to fix have multi "dot" file name issue

Update: try to know this repo how working,so may can help fix multi "dot" file name issue🫡

Yomisana commented 8 months ago

@Terroosh Hi there This issue may you need ask A1111-Webui about lora file name multi dot file, I guess webui will use . "dot" split not like my way use last "(" to detect

~~this is my test screen shot and that last not found console output is A1111 output not this extension :< bug "Lora not found" I find this repo not saw some same output code and I had open webui if lora miss will notify so I confirm is A1111 deal with lora name have like I said issue~~

So the best way now is change the file name and webui setting lora use filename prompt, and wait dev to fix have multi "dot" file name issue

but I think this issue may not fix or need to wait have new process :) Right now best way change file name "." change to "_ "

Update: file name can't have "." because exporter:28 def apply_lora load to networks will error of file name have dot file, so won't be fix i guess

Yomisana commented 8 months ago

fix multi dot file name issue but the first The whole thing is complicated, need to know yeah it now had multi dot file name can export but... lora network can load is other issue so this issue won't to fix and it off topic of this issue.

Andddd IDK if I change those few code it make me check a lot of file and code,if have bug please tell me and i glad to fix 😄

Terroosh commented 8 months ago

fix multi fot file name issue but the first The whole thing is complicated, need to know yeah it now had multi dot file name can export but... lora network can load is other issue so this issue won't to fix and it off topic of this issue.

Andddd IDK if I change those few code it make me check a lot of file and code,if have bug please tell me and i glad to fix 😄

Works great so far!

Yomisana commented 8 months ago

Just saw this issue when I just open webui today so fix it up.

*** Error executing callback ui_tabs_callback for stable_diffusion_2080ti\extensions\Stable-Diffusion-WebUI-TensorRT\scripts\trt.py
    Traceback (most recent call last):
      File "stable_diffusion_2080ti\modules\script_callbacks.py", line 180, in ui_tabs_callback
        res += c.callback() or []
      File "stable_diffusion_2080ti\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 631, in on_ui_tabs
        choices=get_valid_lora_checkpoints(),
      File "stable_diffusion_2080ti\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 309, in get_valid_lora_checkpoints
        available_lora_models = get_lora_checkpoints()
      File "stable_diffusion_2080ti\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 286, in get_lora_checkpoints
        config = json.load(f)
      File "json\__init__.py", line 293, in load
    UnicodeDecodeError: 'cp950' codec can't decode byte 0xe3 in position 216: illegal multibyte sequence
---