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

use logger.warning_once to avoid massive outputs #27428

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

ranchlai
Copy link
Contributor

What does this PR do?

This is a quick fix to to avoid massive outputs when training/finetuning longformer (for text classifcation) by using logger.warning_once rather than logger.info

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for updating - this is a great suggestion!

Would you mind extending this to our other models in the library?

@ranchlai
Copy link
Contributor Author

Sure! Happy to do that. If I understand correctly, this will only apply to logger.info/warn in the forward() function and the functions called by forward().

@amyeroberts
Copy link
Collaborator

@ranchlai Awesome - thanks! Yep, that's right. Feel free to ping with any questions if you're not sure about any of them.

@@ -264,7 +264,9 @@ def __init__(self, config, layer_id=0):
try:
load_wkv_cuda_kernel(config.context_length)
except Exception:
logger.info("Could not load the custom CUDA kernel for RWKV attention.")
logger.warning_once(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amyeroberts Not quite sure about this. This line is in the init of attention layers.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case, I'd say let's keep it as info as it's really just the exception message, so we want it to be unaffected by the cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will discard this commit

@ranchlai ranchlai force-pushed the update_logging_longformer branch from 5e4076c to d223171 Compare November 14, 2023 01:52
Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for adding all of these!

@huggingface huggingface deleted a comment from github-actions bot Dec 11, 2023
@amyeroberts amyeroberts merged commit e49c385 into huggingface:main Dec 11, 2023
3 checks passed
iantbutler01 pushed a commit to BismuthCloud/transformers that referenced this pull request Dec 16, 2023
* use logger.warning_once to avoid massive outputs when training/finetuning longformer

* update more
staghado pushed a commit to staghado/transformers that referenced this pull request Jan 15, 2024
* use logger.warning_once to avoid massive outputs when training/finetuning longformer

* update more
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.

2 participants