Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions keras_hub/src/tokenizers/sentence_piece_tokenizer_trainer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import io

from keras_hub.src.utils.tensor_utils import assert_tf_libs_installed

try:
import sentencepiece as spm
import tensorflow as tf
Expand Down Expand Up @@ -77,6 +79,7 @@ def compute_sentence_piece_proto(
tf.Tensor([ 4 8 12 5 9 14 5 6 13 4 7 10 11 6 13],
shape=(15,), dtype=int32)
"""
assert_tf_libs_installed("compute_sentence_piece_proto")

if spm is None:
raise ImportError(
Expand Down
3 changes: 3 additions & 0 deletions keras_hub/src/tokenizers/word_piece_tokenizer_trainer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.tokenizers.word_piece_tokenizer import pretokenize
from keras_hub.src.utils.tensor_utils import assert_tf_libs_installed

try:
import tensorflow as tf
Expand Down Expand Up @@ -117,6 +118,8 @@ def normalize_and_split(x):
inputs.map(tokenizer.tokenize)
```
""" # noqa: E501
assert_tf_libs_installed("compute_word_piece_vocabulary")

# Read data files.
if not isinstance(data, (list, tf.data.Dataset)):
raise ValueError(
Expand Down
Loading