absolute imports
Browse files- configuration_gpt2.py +4 -4
- modeling_gpt2.py +6 -6
configuration_gpt2.py
CHANGED
@@ -17,10 +17,10 @@
|
|
17 |
from collections import OrderedDict
|
18 |
from typing import Any, List, Mapping, Optional
|
19 |
|
20 |
-
from
|
21 |
-
from
|
22 |
-
from
|
23 |
-
from
|
24 |
|
25 |
|
26 |
logger = logging.get_logger(__name__)
|
|
|
17 |
from collections import OrderedDict
|
18 |
from typing import Any, List, Mapping, Optional
|
19 |
|
20 |
+
from transformers import PreTrainedTokenizer, TensorType, is_torch_available
|
21 |
+
from transformers.configuration_utils import PretrainedConfig
|
22 |
+
from transformers.onnx import OnnxConfigWithPast, PatchingSpec
|
23 |
+
from transformers.utils import logging
|
24 |
|
25 |
|
26 |
logger = logging.get_logger(__name__)
|
modeling_gpt2.py
CHANGED
@@ -27,17 +27,17 @@ from torch import nn
|
|
27 |
from torch.cuda.amp import autocast
|
28 |
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
29 |
|
30 |
-
from
|
31 |
-
from
|
32 |
BaseModelOutputWithPastAndCrossAttentions,
|
33 |
CausalLMOutputWithCrossAttentions,
|
34 |
QuestionAnsweringModelOutput,
|
35 |
SequenceClassifierOutputWithPast,
|
36 |
TokenClassifierOutput,
|
37 |
)
|
38 |
-
from
|
39 |
-
from
|
40 |
-
from
|
41 |
ModelOutput,
|
42 |
add_code_sample_docstrings,
|
43 |
add_start_docstrings,
|
@@ -45,7 +45,7 @@ from ...utils import (
|
|
45 |
logging,
|
46 |
replace_return_docstrings,
|
47 |
)
|
48 |
-
from
|
49 |
from .configuration_gpt2 import GPT2Config
|
50 |
|
51 |
|
|
|
27 |
from torch.cuda.amp import autocast
|
28 |
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
29 |
|
30 |
+
from transformers.activations import ACT2FN
|
31 |
+
from transformers.modeling_outputs import (
|
32 |
BaseModelOutputWithPastAndCrossAttentions,
|
33 |
CausalLMOutputWithCrossAttentions,
|
34 |
QuestionAnsweringModelOutput,
|
35 |
SequenceClassifierOutputWithPast,
|
36 |
TokenClassifierOutput,
|
37 |
)
|
38 |
+
from transformers.modeling_utils import PreTrainedModel, SequenceSummary
|
39 |
+
from transformers.pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
|
40 |
+
from transformers.utils import (
|
41 |
ModelOutput,
|
42 |
add_code_sample_docstrings,
|
43 |
add_start_docstrings,
|
|
|
45 |
logging,
|
46 |
replace_return_docstrings,
|
47 |
)
|
48 |
+
from transformers.utils.model_parallel_utils import assert_device_map, get_device_map
|
49 |
from .configuration_gpt2 import GPT2Config
|
50 |
|
51 |
|