Fix F401 flake8 warning (x88 / 116).
This change is mostly autogenerated with:
$ python -m autoflake --in-place --recursive --remove-all-unused-imports --ignore-init-module-imports examples templates transformers utils hubconf.py setup.py
I made minor changes in the generated diff.
This commit is contained in:
@@ -19,14 +19,13 @@ import math
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch.optim import AdamW
|
from torch.optim import AdamW
|
||||||
from torch.utils.data import BatchSampler, DataLoader, RandomSampler
|
from torch.utils.data import BatchSampler, DataLoader, RandomSampler
|
||||||
from torch.utils.data.distributed import DistributedSampler
|
from torch.utils.data.distributed import DistributedSampler
|
||||||
from tqdm import tqdm, trange
|
from tqdm import tqdm
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
from grouped_batch_sampler import GroupedBatchSampler, create_lengths_groups
|
from grouped_batch_sampler import GroupedBatchSampler, create_lengths_groups
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import argparse
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from transformers import BertForMaskedLM, GPT2LMHeadModel, RobertaForMaskedLM
|
from transformers import GPT2LMHeadModel, RobertaForMaskedLM
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import argparse
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from transformers import BertForMaskedLM, RobertaForMaskedLM
|
from transformers import BertForMaskedLM
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from torch.nn import CrossEntropyLoss, MSELoss
|
from torch.utils.data import DataLoader, SequentialSampler, Subset
|
||||||
from torch.utils.data import DataLoader, SequentialSampler, Subset, TensorDataset
|
|
||||||
from torch.utils.data.distributed import DistributedSampler
|
from torch.utils.data.distributed import DistributedSampler
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import timeit
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset
|
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
|
||||||
from torch.utils.data.distributed import DistributedSampler
|
from torch.utils.data.distributed import DistributedSampler
|
||||||
from tqdm import tqdm, trange
|
from tqdm import tqdm, trange
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
import _pickle as pickle
|
|
||||||
import collections
|
import collections
|
||||||
import datetime
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from .configuration_utils import PretrainedConfig
|
from .configuration_utils import PretrainedConfig
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,8 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
from .configuration_xxx import XxxConfig
|
from .configuration_xxx import XxxConfig
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ from torch.nn import CrossEntropyLoss, MSELoss
|
|||||||
|
|
||||||
from .configuration_xxx import XxxConfig
|
from .configuration_xxx import XxxConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
from .modeling_utils import PreTrainedModel, prune_linear_layer
|
from .modeling_utils import PreTrainedModel
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ from .utils import CACHE_DIR, require_tf, slow
|
|||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
import tensorflow as tf
|
|
||||||
from transformers.modeling_tf_xxx import (
|
from transformers.modeling_tf_xxx import (
|
||||||
TFXxxModel,
|
TFXxxModel,
|
||||||
TFXxxForMaskedLM,
|
TFXxxForMaskedLM,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
import collections
|
import collections
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import unicodedata
|
|
||||||
from io import open
|
from io import open
|
||||||
|
|
||||||
from .tokenization_utils import PreTrainedTokenizer
|
from .tokenization_utils import PreTrainedTokenizer
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from transformers import AutoModel, AutoTokenizer
|
|
||||||
from transformers.commands import BaseTransformersCLICommand
|
from transformers.commands import BaseTransformersCLICommand
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from .configuration_utils import PretrainedConfig
|
from .configuration_utils import PretrainedConfig
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import tensorflow as tf
|
|
||||||
|
|
||||||
from transformers import (
|
from transformers import (
|
||||||
ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import torch
|
import torch
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ import re
|
|||||||
import string
|
import string
|
||||||
from io import open
|
from io import open
|
||||||
|
|
||||||
from tqdm import tqdm
|
from transformers.tokenization_bert import BasicTokenizer
|
||||||
|
|
||||||
from transformers.tokenization_bert import BasicTokenizer, whitespace_tokenize
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import numpy as np
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_torch_available
|
from ...file_utils import is_tf_available, is_torch_available
|
||||||
from ...tokenization_bert import BasicTokenizer, whitespace_tokenize
|
from ...tokenization_bert import whitespace_tokenize
|
||||||
from .utils import DataProcessor, InputExample, InputFeatures
|
from .utils import DataProcessor
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from typing import List
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
from requests.exceptions import HTTPError
|
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ from .configuration_auto import (
|
|||||||
XLMRobertaConfig,
|
XLMRobertaConfig,
|
||||||
XLNetConfig,
|
XLNetConfig,
|
||||||
)
|
)
|
||||||
from .file_utils import add_start_docstrings
|
|
||||||
from .modeling_albert import (
|
from .modeling_albert import (
|
||||||
ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP,
|
ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP,
|
||||||
AlbertForMaskedLM,
|
AlbertForMaskedLM,
|
||||||
@@ -76,7 +75,6 @@ from .modeling_roberta import (
|
|||||||
)
|
)
|
||||||
from .modeling_t5 import T5_PRETRAINED_MODEL_ARCHIVE_MAP, T5Model, T5WithLMHeadModel
|
from .modeling_t5 import T5_PRETRAINED_MODEL_ARCHIVE_MAP, T5Model, T5WithLMHeadModel
|
||||||
from .modeling_transfo_xl import TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_MAP, TransfoXLLMHeadModel, TransfoXLModel
|
from .modeling_transfo_xl import TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_MAP, TransfoXLLMHeadModel, TransfoXLModel
|
||||||
from .modeling_utils import PreTrainedModel, SequenceSummary
|
|
||||||
from .modeling_xlm import (
|
from .modeling_xlm import (
|
||||||
XLM_PRETRAINED_MODEL_ARCHIVE_MAP,
|
XLM_PRETRAINED_MODEL_ARCHIVE_MAP,
|
||||||
XLMForQuestionAnswering,
|
XLMForQuestionAnswering,
|
||||||
|
|||||||
@@ -23,11 +23,10 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.nn import CrossEntropyLoss
|
from torch.nn import CrossEntropyLoss
|
||||||
from torch.nn.parameter import Parameter
|
|
||||||
|
|
||||||
from .configuration_ctrl import CTRLConfig
|
from .configuration_ctrl import CTRLConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
from .modeling_utils import Conv1D, PreTrainedModel, SequenceSummary, prune_conv1d_layer
|
from .modeling_utils import Conv1D, PreTrainedModel
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import os
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from tqdm import trange
|
|
||||||
|
|
||||||
from .modeling_auto import AutoModel, AutoModelWithLMHead
|
from .modeling_auto import AutoModel, AutoModelWithLMHead
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import os
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.nn import CrossEntropyLoss
|
from torch.nn import CrossEntropyLoss
|
||||||
from torch.nn.parameter import Parameter
|
|
||||||
|
|
||||||
from .configuration_gpt2 import GPT2Config
|
from .configuration_gpt2 import GPT2Config
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
@@ -47,7 +46,6 @@ def load_tf_weights_in_gpt2(model, config, gpt2_checkpoint_path):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import re
|
import re
|
||||||
import numpy as np
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ from io import open
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.nn import CrossEntropyLoss
|
from torch.nn import CrossEntropyLoss
|
||||||
from torch.nn.parameter import Parameter
|
|
||||||
|
|
||||||
from .configuration_openai import OpenAIGPTConfig
|
from .configuration_openai import OpenAIGPTConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import os
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torch.nn import CrossEntropyLoss, MSELoss
|
from torch.nn import CrossEntropyLoss
|
||||||
|
|
||||||
from .configuration_t5 import T5Config
|
from .configuration_t5 import T5Config
|
||||||
from .file_utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings
|
from .file_utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ from .configuration_auto import (
|
|||||||
XLMConfig,
|
XLMConfig,
|
||||||
XLNetConfig,
|
XLNetConfig,
|
||||||
)
|
)
|
||||||
from .file_utils import add_start_docstrings
|
|
||||||
from .modeling_tf_albert import (
|
from .modeling_tf_albert import (
|
||||||
TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP,
|
TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP,
|
||||||
TFAlbertForMaskedLM,
|
TFAlbertForMaskedLM,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import tensorflow as tf
|
|||||||
|
|
||||||
from .configuration_ctrl import CTRLConfig
|
from .configuration_ctrl import CTRLConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
from .modeling_tf_utils import TFPreTrainedModel, TFSharedEmbeddings, get_initializer, shape_list
|
from .modeling_tf_utils import TFPreTrainedModel, TFSharedEmbeddings, shape_list
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
"""
|
"""
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ def load_pytorch_checkpoint_in_tf2_model(tf_model, pytorch_checkpoint_path, tf_i
|
|||||||
""" Load pytorch checkpoints in a TF 2.0 model
|
""" Load pytorch checkpoints in a TF 2.0 model
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import tensorflow as tf
|
import tensorflow as tf # noqa: F401
|
||||||
import torch
|
import torch # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Loading a PyTorch model in TensorFlow, requires both PyTorch and TensorFlow to be installed. Please see "
|
"Loading a PyTorch model in TensorFlow, requires both PyTorch and TensorFlow to be installed. Please see "
|
||||||
@@ -109,8 +109,8 @@ def load_pytorch_weights_in_tf2_model(tf_model, pt_state_dict, tf_inputs=None, a
|
|||||||
""" Load pytorch state_dict in a TF 2.0 model.
|
""" Load pytorch state_dict in a TF 2.0 model.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import torch
|
import torch # noqa: F401
|
||||||
import tensorflow as tf
|
import tensorflow as tf # noqa: F401
|
||||||
from tensorflow.python.keras import backend as K
|
from tensorflow.python.keras import backend as K
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
@@ -208,8 +208,8 @@ def load_tf2_checkpoint_in_pytorch_model(pt_model, tf_checkpoint_path, tf_inputs
|
|||||||
(see https://github.com/tensorflow/tensorflow/blob/ee16fcac960ae660e0e4496658a366e2f745e1f0/tensorflow/python/keras/engine/network.py#L1352-L1357).
|
(see https://github.com/tensorflow/tensorflow/blob/ee16fcac960ae660e0e4496658a366e2f745e1f0/tensorflow/python/keras/engine/network.py#L1352-L1357).
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import tensorflow as tf
|
import tensorflow as tf # noqa: F401
|
||||||
import torch
|
import torch # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see "
|
"Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see "
|
||||||
@@ -250,8 +250,8 @@ def load_tf2_weights_in_pytorch_model(pt_model, tf_weights, allow_missing_keys=F
|
|||||||
""" Load TF2.0 symbolic weights in a PyTorch model
|
""" Load TF2.0 symbolic weights in a PyTorch model
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import tensorflow as tf
|
import tensorflow as tf # noqa: F401
|
||||||
import torch
|
import torch # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see "
|
"Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see "
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import tensorflow as tf
|
|||||||
|
|
||||||
from .configuration_roberta import RobertaConfig
|
from .configuration_roberta import RobertaConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
from .modeling_tf_bert import TFBertEmbeddings, TFBertMainLayer, gelu, gelu_new
|
from .modeling_tf_bert import TFBertEmbeddings, TFBertMainLayer, gelu
|
||||||
from .modeling_tf_utils import TFPreTrainedModel, get_initializer, shape_list
|
from .modeling_tf_utils import TFPreTrainedModel, get_initializer, shape_list
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,12 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
from .configuration_transfo_xl import TransfoXLConfig
|
from .configuration_transfo_xl import TransfoXLConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
from .modeling_tf_transfo_xl_utilities import TFAdaptiveSoftmaxMask
|
from .modeling_tf_transfo_xl_utilities import TFAdaptiveSoftmaxMask
|
||||||
from .modeling_tf_utils import TFConv1D, TFPreTrainedModel, TFSequenceSummary, get_initializer, shape_list
|
from .modeling_tf_utils import TFPreTrainedModel, get_initializer, shape_list
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
from .modeling_tf_utils import shape_list
|
from .modeling_tf_utils import shape_list
|
||||||
|
|||||||
@@ -25,13 +25,11 @@ import logging
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch.nn import CrossEntropyLoss
|
|
||||||
from torch.nn.parameter import Parameter
|
|
||||||
|
|
||||||
from .configuration_transfo_xl import TransfoXLConfig
|
from .configuration_transfo_xl import TransfoXLConfig
|
||||||
from .file_utils import add_start_docstrings
|
from .file_utils import add_start_docstrings
|
||||||
from .modeling_transfo_xl_utilities import LogUniformSampler, ProjectedAdaptiveLogSoftmax, sample_logits
|
from .modeling_transfo_xl_utilities import LogUniformSampler, ProjectedAdaptiveLogSoftmax, sample_logits
|
||||||
from .modeling_utils import Conv1D, PreTrainedModel, SequenceSummary, prune_conv1d_layer
|
from .modeling_utils import PreTrainedModel
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
|
||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torch.nn import CrossEntropyLoss
|
from torch.nn import CrossEntropyLoss
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import pickle
|
|||||||
import sys
|
import sys
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from itertools import groupby
|
|
||||||
from os.path import abspath, exists
|
from os.path import abspath, exists
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ if is_torch_available():
|
|||||||
)
|
)
|
||||||
from transformers.modeling_bert import BERT_PRETRAINED_MODEL_ARCHIVE_MAP
|
from transformers.modeling_bert import BERT_PRETRAINED_MODEL_ARCHIVE_MAP
|
||||||
|
|
||||||
from .modeling_common_test import CommonTestCases, ids_tensor
|
|
||||||
from .configuration_common_test import ConfigTester
|
|
||||||
|
|
||||||
|
|
||||||
@require_torch
|
@require_torch
|
||||||
class AutoModelTest(unittest.TestCase):
|
class AutoModelTest(unittest.TestCase):
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from transformers import is_torch_available
|
|||||||
|
|
||||||
from .configuration_common_test import ConfigTester
|
from .configuration_common_test import ConfigTester
|
||||||
from .modeling_common_test import CommonTestCases, ids_tensor
|
from .modeling_common_test import CommonTestCases, ids_tensor
|
||||||
from .utils import CACHE_DIR, require_torch, slow, torch_device
|
from .utils import require_torch, torch_device
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import unittest
|
|||||||
from transformers import is_torch_available
|
from transformers import is_torch_available
|
||||||
|
|
||||||
from .configuration_common_test import ConfigTester
|
from .configuration_common_test import ConfigTester
|
||||||
from .modeling_common_test import CommonTestCases, floats_tensor, ids_tensor
|
from .modeling_common_test import CommonTestCases, ids_tensor
|
||||||
from .utils import CACHE_DIR, require_torch, slow, torch_device
|
from .utils import CACHE_DIR, require_torch, slow
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ from .utils import CACHE_DIR, require_tf, slow
|
|||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
import tensorflow as tf
|
|
||||||
from transformers.modeling_tf_albert import (
|
from transformers.modeling_tf_albert import (
|
||||||
TFAlbertModel,
|
TFAlbertModel,
|
||||||
TFAlbertForMaskedLM,
|
TFAlbertForMaskedLM,
|
||||||
|
|||||||
@@ -35,10 +35,6 @@ if is_tf_available():
|
|||||||
TFAutoModelForQuestionAnswering,
|
TFAutoModelForQuestionAnswering,
|
||||||
TFBertForQuestionAnswering,
|
TFBertForQuestionAnswering,
|
||||||
)
|
)
|
||||||
from transformers.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_MAP
|
|
||||||
|
|
||||||
from .modeling_common_test import CommonTestCases, ids_tensor
|
|
||||||
from .configuration_common_test import ConfigTester
|
|
||||||
|
|
||||||
|
|
||||||
@require_tf
|
@require_tf
|
||||||
|
|||||||
@@ -24,13 +24,12 @@ import unittest
|
|||||||
|
|
||||||
from transformers import is_tf_available, is_torch_available
|
from transformers import is_tf_available, is_torch_available
|
||||||
|
|
||||||
from .utils import require_tf, slow
|
from .utils import require_tf
|
||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from transformers import TFPreTrainedModel
|
|
||||||
|
|
||||||
# from transformers.modeling_bert import BertModel, BertConfig, BERT_PRETRAINED_MODEL_ARCHIVE_MAP
|
# from transformers.modeling_bert import BertModel, BertConfig, BERT_PRETRAINED_MODEL_ARCHIVE_MAP
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ from .utils import CACHE_DIR, require_tf, slow
|
|||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
import tensorflow as tf
|
|
||||||
from transformers.modeling_tf_ctrl import TFCTRLModel, TFCTRLLMHeadModel, TF_CTRL_PRETRAINED_MODEL_ARCHIVE_MAP
|
from transformers.modeling_tf_ctrl import TFCTRLModel, TFCTRLLMHeadModel, TF_CTRL_PRETRAINED_MODEL_ARCHIVE_MAP
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,10 @@ from transformers import DistilBertConfig, is_tf_available
|
|||||||
|
|
||||||
from .configuration_common_test import ConfigTester
|
from .configuration_common_test import ConfigTester
|
||||||
from .modeling_tf_common_test import TFCommonTestCases, ids_tensor
|
from .modeling_tf_common_test import TFCommonTestCases, ids_tensor
|
||||||
from .utils import CACHE_DIR, require_tf, slow
|
from .utils import require_tf
|
||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
import tensorflow as tf
|
|
||||||
from transformers.modeling_tf_distilbert import (
|
from transformers.modeling_tf_distilbert import (
|
||||||
TFDistilBertModel,
|
TFDistilBertModel,
|
||||||
TFDistilBertForMaskedLM,
|
TFDistilBertForMaskedLM,
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ from .utils import CACHE_DIR, require_tf, slow
|
|||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
import tensorflow as tf
|
from transformers.modeling_tf_t5 import TFT5Model, TFT5WithLMHeadModel
|
||||||
from transformers.modeling_tf_t5 import TFT5Model, TFT5WithLMHeadModel, TF_T5_PRETRAINED_MODEL_ARCHIVE_MAP
|
|
||||||
|
|
||||||
|
|
||||||
@require_tf
|
@require_tf
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from transformers.tokenization_albert import SPIECE_UNDERLINE, AlbertTokenizer
|
from transformers.tokenization_albert import AlbertTokenizer
|
||||||
|
|
||||||
from .tokenization_tests_commons import CommonTestCases
|
from .tokenization_tests_commons import CommonTestCases
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import unittest
|
|||||||
from transformers.tokenization_distilbert import DistilBertTokenizer
|
from transformers.tokenization_distilbert import DistilBertTokenizer
|
||||||
|
|
||||||
from .tokenization_bert_test import BertTokenizationTest
|
from .tokenization_bert_test import BertTokenizationTest
|
||||||
from .tokenization_tests_commons import CommonTestCases
|
|
||||||
from .utils import slow
|
from .utils import slow
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ from .utils import require_torch
|
|||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
import torch
|
|
||||||
from transformers.tokenization_transfo_xl import TransfoXLTokenizer, VOCAB_FILES_NAMES
|
from transformers.tokenization_transfo_xl import TransfoXLTokenizer, VOCAB_FILES_NAMES
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import unicodedata
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from .tokenization_bert import BasicTokenizer, BertTokenizer, WordpieceTokenizer, load_vocab
|
from .tokenization_bert import BasicTokenizer, BertTokenizer, WordpieceTokenizer, load_vocab
|
||||||
from .tokenization_utils import PreTrainedTokenizer
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import unicodedata
|
|
||||||
|
|
||||||
from .tokenization_bert import BertTokenizer
|
from .tokenization_bert import BertTokenizer
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import regex as re
|
|
||||||
|
|
||||||
from .tokenization_gpt2 import GPT2Tokenizer
|
from .tokenization_gpt2 import GPT2Tokenizer
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ from io import open
|
|||||||
|
|
||||||
import sacremoses as sm
|
import sacremoses as sm
|
||||||
|
|
||||||
from .tokenization_bert import BasicTokenizer
|
|
||||||
from .tokenization_utils import PreTrainedTokenizer
|
from .tokenization_utils import PreTrainedTokenizer
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user