Update model.py
Browse files
model.py
CHANGED
|
@@ -16,7 +16,7 @@ from transformers.activations import ACT2FN
|
|
| 16 |
from transformers.modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_causal_attention_mask
|
| 17 |
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
|
| 18 |
from transformers.modeling_utils import PreTrainedModel
|
| 19 |
-
from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
|
| 20 |
from transformers.utils import (
|
| 21 |
add_start_docstrings,
|
| 22 |
add_start_docstrings_to_model_forward,
|
|
@@ -36,8 +36,8 @@ if is_flash_attn_2_available():
|
|
| 36 |
# This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
|
| 37 |
# It means that the function will not be traced through and simply appear as a node in the graph.
|
| 38 |
if is_torch_fx_available():
|
| 39 |
-
|
| 40 |
-
|
| 41 |
|
| 42 |
_prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)
|
| 43 |
|
|
|
|
| 16 |
from transformers.modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_causal_attention_mask
|
| 17 |
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
|
| 18 |
from transformers.modeling_utils import PreTrainedModel
|
| 19 |
+
from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
|
| 20 |
from transformers.utils import (
|
| 21 |
add_start_docstrings,
|
| 22 |
add_start_docstrings_to_model_forward,
|
|
|
|
| 36 |
# This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
|
| 37 |
# It means that the function will not be traced through and simply appear as a node in the graph.
|
| 38 |
if is_torch_fx_available():
|
| 39 |
+
|
| 40 |
+
import torch.fx
|
| 41 |
|
| 42 |
_prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)
|
| 43 |
|