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

Added abilty to log prompts and info to one file instead of several #476

Merged
merged 8 commits into from
Sep 3, 2022
Merged

Added abilty to log prompts and info to one file instead of several #476

merged 8 commits into from
Sep 3, 2022

Conversation

TingTingin
Copy link
Contributor

This is my first pull request be gentle I made changes so instead of having a file with prompt info for each sample you can just have one file with the prompt info for all files I also made sure the prompts would work with params in prompts

This is my first pull request be gentle I made changes so instead of having several files with prompts with one for each file you can just have one file with the prompt info I also made sure the prompts would work with params in prompts
Copy link
Contributor

@JohannesGaessler JohannesGaessler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% what you mean by "dynamic parameters".
What I think your goal is: writing a log file with prompts and other parameters.
If your goal is a log file you should also include timestamps.
Keep in mind that I have a pending PR #436 that lets users paste parameters, but only the yaml format is understood.
If compatibility is desired the format of the log file should be changed to YAML with the different flow style (looks like when you print a dictionary with Python).

if write_info_to_one_file:
ignore_list = ["prompt", "target", "toggles", "ddim_eta", "batch_size"]
rename_dict = {"ddim_steps": "steps", "n_iter": "number", "sampler_name": "sampler"} #changes the name of parameters to match with dynamic parameters
sample_log_path = os.path.join(sample_path_i, "log.yaml")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use the ".yaml" file ending for log files, that will confuse users trying to load settings from them using #436 .
Use a file name that ends with ".txt" or ".log" instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will change

rename_dict = {"ddim_steps": "steps", "n_iter": "number", "sampler_name": "sampler"} #changes the name of parameters to match with dynamic parameters
sample_log_path = os.path.join(sample_path_i, "log.yaml")
log_dump = info_dict.get("prompt") # making sure the first item that is listed in the txt is the prompt text
for key, value in info_dict.items():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterating over a dictionary is not guaranteed to yield items in a particular order.
With this code the order of the printed parameters can change randomly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean for it to be in any particular order do you think that would be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if that will be better.
I was merely telling you because I don't know how experienced you are.


if found_key:
key = found_key
log_dump += f" {key} {value}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be difficult to read.
I recommend using different separators between key and value and two pairs of key and value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the point is so you can copy them using #421 if I add separators it will break that

webui.py Outdated
@@ -1852,6 +1884,7 @@ def run_RealESRGAN(image, model_name: str):
'Save grid',
'Sort samples by prompt',
'Write sample info files',
'Write sample info to one file',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming is misleading.
It will make users think that if they tick both individual sample files will not be written.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funnily I wasn't really sure what to name it do you have any suggestions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your goal is a log file: "Write sample log files"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No wait, your files are explicitly not per sample.
"Write log files"?

Copy link
Contributor Author

@TingTingin TingTingin Sep 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe
write sample info to log file?

@TingTingin
Copy link
Contributor Author

TingTingin commented Sep 2, 2022

I am not 100% what you mean by "dynamic parameters". What I think your goal is: writing a log file with prompts and other parameters. If your goal is a log file you should also include timestamps. Keep in mind that I have a pending PR #436 that lets users paste parameters, but only the yaml format is understood. If compatibility is desired the format of the log file should be changed to YAML with the different flow style (looks like when you print a dictionary with Python).

I meant this #421 you can copy the line from the file and paste it into the prompt and it will auto add the parameters

@JohannesGaessler
Copy link
Contributor

That's what I was assuming.
In a simple test trying to paste from the files I generated with your code or trying to paste the text that I get with the "Copy full parameters" button does not correctly apply all parameters though.

@TingTingin
Copy link
Contributor Author

TingTingin commented Sep 2, 2022

Working for me in the video I copy and paste the parameters

test.mp4

sampler doesn't get applied I think that's something with dynamic

@JohannesGaessler
Copy link
Contributor

The order of parameters in your video is the same as on my system so it's not the dictionary randomly reordering things that's causing problems.
I suspect a bug in the dynamic parameters implementation.

@TingTingin
Copy link
Contributor Author

I made a mistake with the last commit fixing now

@hlky hlky merged commit e35fcb9 into Sygil-Dev:master Sep 3, 2022
jjisnow pushed a commit to jjisnow/stable-diffusion-webui that referenced this pull request Sep 3, 2022
…ygil-Dev#476)

* Added abilty to log prompts and info to one file instead of several

This is my first pull request be gentle I made changes so instead of having several files with prompts with one for each file you can just have one file with the prompt info I also made sure the prompts would work with params in prompts

* Add files via upload

* Fixed Image to image not working

* Add files via upload

* Revert "Add files via upload"

This reverts commit bb10b63.

* updated log

Co-authored-by: hlky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants