mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
make sentencepiece import conditional in bertjapanesetokenizer (#20012)
This commit is contained in:
parent
8827e1b217
commit
2e3452af0f
@ -21,12 +21,15 @@ import os
|
||||
import unicodedata
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
import sentencepiece as spm
|
||||
|
||||
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
|
||||
from ...utils import logging
|
||||
from ...utils import is_sentencepiece_available, logging
|
||||
|
||||
|
||||
if is_sentencepiece_available():
|
||||
import sentencepiece as spm
|
||||
else:
|
||||
spm = None
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.txt", "spm_file": "spiece.model"}
|
||||
|
Loading…
Reference in New Issue
Block a user