Remove import fallbacks.

This commit is contained in:
Aymeric Augustin 2019-12-22 18:19:07 +01:00
parent 798b3b3899
commit 75a23d24af
4 changed files with 3 additions and 29 deletions

View File

@ -18,19 +18,13 @@ import argparse
import logging
import sys
import unittest
from unittest.mock import patch
import run_generation
import run_glue
import run_squad
try:
# python 3.4+ can use builtin unittest.mock instead of mock package
from unittest.mock import patch
except ImportError:
from mock import patch
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()

View File

@ -15,6 +15,7 @@ from contextlib import contextmanager
from functools import partial, wraps
from hashlib import sha256
from io import open
from urllib.parse import urlparse
import boto3
import requests
@ -65,10 +66,6 @@ except ImportError:
)
default_cache_path = os.path.join(torch_cache_home, "transformers")
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
try:
from pathlib import Path

View File

@ -18,6 +18,7 @@
import json
import logging
import os
from functools import lru_cache
from io import open
import regex as re
@ -25,15 +26,6 @@ import regex as re
from .tokenization_utils import PreTrainedTokenizer
try:
from functools import lru_cache
except ImportError:
# Just a dummy decorator to get the checks to run on python2
# because honestly I don't want to support a byte-level unicode BPE tokenizer on python 2 right now.
def lru_cache():
return lambda func: func
logger = logging.getLogger(__name__)
VOCAB_FILES_NAMES = {

View File

@ -20,15 +20,6 @@ import logging
from .tokenization_gpt2 import GPT2Tokenizer
try:
from functools import lru_cache
except ImportError:
# Just a dummy decorator to get the checks to run on python2
# because honestly I don't want to support a byte-level unicode BPE tokenizer on python 2 right now.
def lru_cache():
return lambda func: func
logger = logging.getLogger(__name__)
VOCAB_FILES_NAMES = {