Skip to content

Commit

Permalink
Change import of to directly import (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampathweb authored and mattdangerw committed Jan 25, 2023
1 parent 729815b commit dec9614
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions keras_nlp/metrics/rouge_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
from keras_nlp.utils.tf_utils import tensor_to_string_list

try:
import rouge_score
from rouge_score import rouge_scorer
except ImportError:
rouge_score = None
rouge_scorer = None


class RougeBase(keras.metrics.Metric):
Expand Down Expand Up @@ -63,7 +62,7 @@ def __init__(
):
super().__init__(name=name, dtype=dtype, **kwargs)

if rouge_score is None:
if rouge_scorer is None:
raise ImportError(
f"{self.__class__.__name__} requires the `rouge_score` "
"package. Please install it with `pip install rouge-score`."
Expand Down

0 comments on commit dec9614

Please sign in to comment.