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

log loss per image #7278

Merged
merged 5 commits into from
Mar 14, 2024
Merged

log loss per image #7278

merged 5 commits into from
Mar 14, 2024

Conversation

noskill
Copy link
Contributor

@noskill noskill commented Mar 11, 2024

What does this PR do?

logging loss for each image in dataset. Given that Lora datasets are usually small this feature might help to one to spot low-quality images or bad captions etc.

Copy link
Member

@sayakpaul sayakpaul 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 generally okay with this direction. Let's maybe not introduce the unnecessary spacing changes?

@@ -19,6 +19,7 @@
import logging
import math
import os
import os.path
Copy link
Member

Choose a reason for hiding this comment

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

We already have os module imported. I think we can reuse it.

Comment on lines 1081 to 1082
for fname in batch['filenames']:
accelerator.log({'loss_for_' + fname: loss}, step=global_step)
Copy link
Member

Choose a reason for hiding this comment

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

Should we accept a CLI argument for this? That will be nice no?

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 agree, it's nice to have.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

LGTM! Let's fix the code quality issues.

@noskill
Copy link
Contributor Author

noskill commented Mar 12, 2024

@sayakpaul Which code quality issues? What should i fix?

@sayakpaul
Copy link
Member

The CI says:

image

To be more specific the following step in the CI fails:

Fast tests for PRs / check_code_quality (pull_request)

You need to run make style && make quality to fix these.

@noskill noskill requested a review from sayakpaul March 13, 2024 07:04
Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks! Just one comment. Once addressed, will ship!

parser.add_argument(
"--debug-loss",
action="store_true",
default=False,
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to set a default for boolean flag CLI args. If someone doesn't pass --debug-loss it will be defaulted to False. Also, we use "_" rather than "-" even for CLI args.

@noskill noskill requested a review from sayakpaul March 13, 2024 13:24
Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Clean!

@noskill
Copy link
Contributor Author

noskill commented Mar 14, 2024

Great! Could you please merge the PR?

@sayakpaul sayakpaul merged commit 53e9aac into huggingface:main Mar 14, 2024
8 checks passed
@sayakpaul
Copy link
Member

Let's go!

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