make a few changes the import from transformers
Browse files- modeling_gpt2.py +6 -6
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 |
|