bmaltais / kohya_ss

Apache License 2.0
8.79k stars 1.14k forks source link

change command Print for easy formatting and run in terminal #2605

Closed rafstahelin closed 1 week ago

rafstahelin commented 1 week ago

The print gives a strange line escape which makes it hard to copy the command for cli launch

Example:

/workspace/kohya_ss/venv/bin/accelerate launch         
                         --dynamo_backend no --dynamo_mode default --gpu_ids 0  
                         --mixed_precision bf16 --num_processes 1 --num_machines
                         1 --num_cpu_threads_per_process 4                      
                         /workspace/kohya_ss/sd-scripts/sdxl_train_network.py   
                         --config_file                                          
                         /workspace/lora/sh1n/00/config_lora-20240623-112920.tom
                         l

Note the letter "l" from the toml file gets placed on a new line

When I copy and format the command it looks like this

/workspace/kohya_ss/venv/bin/accelerate launch --dynamo_backend no --dynamo_mode default --gpu_ids 0 --mixed_precision bf16 --num_processes 1 --num_machines 1 --num_cpu_threads_per_process 4 /workspace/kohya_ss/sd-scripts/sdxl_train_network.py --config_file /workspace/lora/sh1n/00/config_lora-20240623-111927.tom l

Note the end: .tom l

Not sure how to make this Print easier to use

bmaltais commented 1 week ago

The console output is not really meant to copy the command directly for re-run... but rather to provide an idea of what is being executed. I would be possible to output it in a useable format by avoiding the log function... but this would result in an odd looking line compared to the rest.

Not sure I want to change things at this point.

bmaltais commented 1 week ago

I have implement a change that should help. If you use the "Print training command" button it will output the command in a format that you should be able to easily copy and paste.

You will find the update in the dev branch.

rafstahelin commented 1 week ago

thanks so much again Bernard. It looks nice i think. And works for everyone to easily copy. Wonderful