derrian-distro / LoRA_Easy_Training_Scripts

A UI made in Pyside6 to make training LoRA/LoCon and other LoRA type models in sd-scripts easy
GNU General Public License v3.0
998 stars 101 forks source link

runtime_store\config.toml doesn't escape characters under comment section #184

Closed uwidev closed 1 month ago

uwidev commented 4 months ago

Putting new lines characters or double quotes seem to throw this error.

Loading settings from runtime_store\config.toml...
Traceback (most recent call last):
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\toml\decoder.py", line 511, in loads
    ret = decoder.load_line(line, currentlevel, multikey,
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\toml\decoder.py", line 778, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\toml\decoder.py", line 849, in load_value
    raise ValueError("Found tokens after a closed " +
ValueError: Found tokens after a closed string. Invalid TOML.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\train_network.py", line 993, in <module>
    args = train_util.read_config_from_file(args, parser)
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\library\train_util.py", line 3344, in read_config_from_file
    config_dict = toml.load(f)
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\toml\decoder.py", line 156, in load
    return loads(f.read(), _dict, decoder)
  File "E:\Software\Applications\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\toml\decoder.py", line 514, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Found tokens after a closed string. Invalid TOML. (line 13 column 1 char 424)
Failed to train because of error:
Command '['E:\\Software\\Applications\\LoRA_Easy_Training_Scripts\\sd_scripts\\venv\\Scripts\\python.exe', 'sd_scripts\\train_network.py', '--config_file=runtime_store\\config.toml', '--dataset_config=runtime_store\\dataset.toml']' returned non-zero exit status 1.

I'm assuming this would occur because the comment section isn't escaped when written to the runtime config toml. This does not seem to occur when saving the toml manually.

Currently on latest branch as of 2/25/24, Windows 10.

derrian-distro commented 4 months ago

yeah, it's related to that, I'm working on solving it, I'm pretty sure I've already solved it, but I still need to test more

Jelosus2 commented 1 month ago

Closing this as the only real way to fix this would be to remove the characters that gives problems.