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

[Feature Request] Loading the json configuration without a modal window #353

Closed
ruSauron opened this issue Mar 10, 2023 · 5 comments
Closed
Labels
enhancement New feature or request

Comments

@ruSauron
Copy link

ruSauron commented Mar 10, 2023

This request is a bit related to #262.

By Server, I will mean the computer where the kohya_gui.py is running. By remote device, I will mean another computer that has the webui GUI open in a browser.

The --listen mode implies the ability to control the workout from another device.

The Open button opens a modal window on the server. I can't find a way to load the config on the remote device without accessing the server instead of having to re-set them manually.

I see 2 ways to implement this, but it doesn't have to be this way.

  1. Quite simple. Add a new (4th) button, which without "Open file" window tries to load the json file from the path specified in the textbox. Possible error messages such as no such file should be visible in the browser on the remote device. There should be no visible events on the server, except for a possible log to the console.
    It would also be great to read the path to this json file from the address bar, for example,
    http://127.0.0.1:7861/?__theme=dark&__json=D:\AI\Lora\myconfig.json
    That would also solve issue Feature Request : Auto load a config file #262

  2. Completely change the way the Configuration file interface works. If webui is not opened from 127.0.0.1 / localhost or if you have some special parameter in your address bar the "Open" button should open dialog on remote device instead of server, then save json from remote device to temporary server folder and then read configuration from this file. The "Save as..." button should then download the json file into the download on the remote device.

@bmaltais bmaltais added the enhancement New feature or request label Mar 10, 2023
@bmaltais
Copy link
Owner

Yeah... it is annoying me also... especially when I paste the path to the json file and it still open the dialog... I will try to implement the 4th button one can use to open the file in the field... and if it is not present it will simply. output an error message to the consele.

I will also add an option to pass the json file to the gui to load the config on startup... this should take cake of both of those ;-)

@bmaltais
Copy link
Owner

OK, I have implemented the 1st thing to load the config without opening the modal window. It is pushed to the dev branch.

Now... for the 2nd it is a bit harder because each tab has it's own config... and there is nothing in the config file that specify what tab the config is for... so I can't just take an argument to load the config... I would need two arguments... one for the target tab and another for the config... this is not nice... any suggestion?

@ruSauron
Copy link
Author

ruSauron commented Mar 11, 2023

OK, I have implemented the 1st thing to load the config without opening the modal window. It is pushed to the dev branch.

Now... for the 2nd it is a bit harder because each tab has it's own config... and there is nothing in the config file that specify what tab the config is for... so I can't just take an argument to load the config... I would need two arguments... one for the target tab and another for the config... this is not nice... any suggestion?

Tried the new load button - it works perfect, thanks!

At the moment you can use the configuration file path from the URL as the default text value on all the tabs and not load the json until the user clicks on a newly added button on the tab they want

I think that 2nd argument is fine. In this case, if the tab is specified, you can immediately try to apply the configuration from the specified json file
&__mode= dreambooth / lora / ti / finetune
you could also give the option to use a short designation, such as &__mode=1-4

instead of "mode" is also a fine word is "tab"

@FlowDownTheRiver
Copy link

FlowDownTheRiver commented Mar 11, 2023

Now... for the 2nd it is a bit harder because each tab has it's own config... and there is nothing in the config file that specify what tab the config is for... so I can't just take an argument to load the config... I would need two arguments... one for the target tab and another for the config... this is not nice... any suggestion?

I am not sure if I get it right and I am a python beginner,but when I was trying to implement batch inpainting feature for automatic's webUI, in modules\ui.py specifically for his repo,he was using a seperate structure for each tab,some element id for tabs,but then he implemented some shared feature for the tabs,so it bacame easy like you can edit some numbers for the tabs from 1 to n'th tab,and then that shared feature is carried to that tab. I can't remember the exact code now,but it is like a class and you inherit some part from that class to another. The reason I tell this cos before you needed to edit code and do a lot of stuff manually but with that shared option,numbers could be used.

So maybe like filename structure and tabs to be named with number or the tab name. If it is a dreambooth config ,config file can be saved with some specific filename my_config_dreambooth.json, my_config_dreambooth_0001.json , if it is lora config,my_config_lora.json etc. Regex can be used to check filename,or maybe you can embed the config info inside the json file completely. So json file shall have some entry,that it is lora,finetune or whatever.Then when it is loading the config,it first checks the config file type then it loads it for the related tab.

but when I use for example this bat file :

@echo off

set VENV_DIR=.\venv
set PYTHON=python
git pull
call %VENV_DIR%\Scripts\activate.bat
start "firefox.exe" http://127.0.0.1:7870
%PYTHON% lora_gui.py --server_port 7870

this exclusively calls lora gui,so there are no extra tabs for dreambooth or whatever,then the numbers can fail.Then the viable or reliable option is to save the info directly into the json file itself and if not, filenames shall be automatically renamed when saving with a suffix maybe.

@ruSauron
Copy link
Author

ruSauron commented Mar 26, 2023

OK, I have implemented the 1st thing to load the config without opening the modal window. It is pushed to the dev branch.

Now... for the 2nd it is a bit harder because each tab has it's own config... and there is nothing in the config file that specify what tab the config is for... so I can't just take an argument to load the config... I would need two arguments... one for the target tab and another for the config... this is not nice... any suggestion?

Check this, please: https://github.aiurs.co/gradio-app/gradio/discussions/2949

Direct link to example:
https://huggingface.co/spaces/radames/gradio-url-params?__theme=light&text_input=My+test+string&second_option=12345678

Source code:
https://huggingface.co/spaces/radames/gradio-url-params/blob/main/app.py

Cauldrath pushed a commit to Cauldrath/kohya_ss that referenced this issue Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants