Update modeling_phi3.py
Browse files- modeling_phi3.py +6 -1
modeling_phi3.py
CHANGED
|
@@ -35,13 +35,18 @@ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS
|
|
| 35 |
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 36 |
from transformers.processing_utils import Unpack
|
| 37 |
from transformers.utils import (
|
| 38 |
-
LossKwargs,
|
| 39 |
add_code_sample_docstrings,
|
| 40 |
add_start_docstrings,
|
| 41 |
add_start_docstrings_to_model_forward,
|
| 42 |
logging,
|
| 43 |
replace_return_docstrings,
|
| 44 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
from transformers.utils.deprecation import deprecate_kwarg
|
| 46 |
from .configuration_phi3 import Phi3Config
|
| 47 |
|
|
|
|
| 35 |
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 36 |
from transformers.processing_utils import Unpack
|
| 37 |
from transformers.utils import (
|
|
|
|
| 38 |
add_code_sample_docstrings,
|
| 39 |
add_start_docstrings,
|
| 40 |
add_start_docstrings_to_model_forward,
|
| 41 |
logging,
|
| 42 |
replace_return_docstrings,
|
| 43 |
)
|
| 44 |
+
|
| 45 |
+
# Robust import for LossKwargs
|
| 46 |
+
try:
|
| 47 |
+
from transformers.utils import LossKwargs
|
| 48 |
+
except ImportError:
|
| 49 |
+
from transformers.utils import TransformersKwargs as LossKwargs
|
| 50 |
from transformers.utils.deprecation import deprecate_kwarg
|
| 51 |
from .configuration_phi3 import Phi3Config
|
| 52 |
|