-
Notifications
You must be signed in to change notification settings - Fork 109
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
A small improvement in metrics_sample.py::ROUGE
#217
A small improvement in metrics_sample.py::ROUGE
#217
Conversation
@@ -323,6 +323,7 @@ def __init__( | |||
normalize_gold: callable = None, | |||
normalize_pred: callable = None, | |||
aggregation_function: callable = None, | |||
tokenizer: object = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use the tokenizer object here transformers.PreTrainedTokenizer
Hi ! Thanks for the PR, could you describe the bug you encoutered and how adding the tokenizer to the rouge function solves it ? |
@NathanHB , One might want to use a tokenizer other than the rouge_1 = SampleLevelMetric(
metric="custom_rouge1",
sample_level_fn=ROUGE("rouge1", tokenizer=nltk.tokenize.SpaceTokenizer()).compute,
category=MetricCategory.GENERATIVE,
use_case=MetricUseCase.SUMMARIZATION,
corpus_level_fn=np.mean,
higher_is_better=True,
)
extend_enum(Metrics, "custom_rouge1", rouge_1) |
Oh that's great then. Just need to make the tests pass and it should be good to merge :) |
b73ad9c
to
5c7f67d
Compare
Hi there!
To fix a tiny bug and do a small improvement to
ROUGE
class.