Update modeling_iquestcoder.py
Browse files- modeling_iquestcoder.py +26 -14
modeling_iquestcoder.py
CHANGED
|
@@ -1,11 +1,28 @@
|
|
| 1 |
-
"""
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
from typing import Callable, List, Optional, Tuple, Union
|
|
@@ -31,7 +48,6 @@ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_u
|
|
| 31 |
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 32 |
from transformers.processing_utils import Unpack
|
| 33 |
from transformers.utils import (
|
| 34 |
-
LossKwargs,
|
| 35 |
auto_docstring,
|
| 36 |
can_return_tuple,
|
| 37 |
is_torch_flex_attn_available,
|
|
@@ -688,10 +704,6 @@ class IQuestCoderModel(IQuestCoderPreTrainedModel):
|
|
| 688 |
# Model Heads
|
| 689 |
# =============================================================================
|
| 690 |
|
| 691 |
-
class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs):
|
| 692 |
-
...
|
| 693 |
-
|
| 694 |
-
|
| 695 |
@auto_docstring
|
| 696 |
class IQuestCoderForCausalLM(IQuestCoderPreTrainedModel, GenerationMixin):
|
| 697 |
"""IQuestCoder Model with a language modeling head on top for causal LM."""
|
|
@@ -742,7 +754,7 @@ class IQuestCoderForCausalLM(IQuestCoderPreTrainedModel, GenerationMixin):
|
|
| 742 |
output_hidden_states: Optional[bool] = None,
|
| 743 |
cache_position: Optional[torch.LongTensor] = None,
|
| 744 |
logits_to_keep: Union[int, torch.Tensor] = 0,
|
| 745 |
-
**kwargs
|
| 746 |
) -> CausalLMOutputWithPast:
|
| 747 |
r"""
|
| 748 |
Args:
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Modified MIT License
|
| 3 |
+
|
| 4 |
+
Software Copyright© 2025 IQuest Research
|
| 5 |
+
|
| 6 |
+
Our only modification is that, if the Software (or any derivative works
|
| 7 |
+
thereof) is used for any of your commercial products or services, you shall
|
| 8 |
+
prominently display "IQuest Coder" on the user interface of such product or
|
| 9 |
+
service.
|
| 10 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 11 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 12 |
+
in the Software without restriction, including without limitation the rights
|
| 13 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 14 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 15 |
+
furnished to do so, subject to the following conditions:
|
| 16 |
+
|
| 17 |
+
The above copyright notice and this permission notice shall be included in all
|
| 18 |
+
copies or substantial portions of the Software.
|
| 19 |
+
|
| 20 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 21 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 22 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 23 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 24 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 25 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 26 |
"""
|
| 27 |
|
| 28 |
from typing import Callable, List, Optional, Tuple, Union
|
|
|
|
| 48 |
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 49 |
from transformers.processing_utils import Unpack
|
| 50 |
from transformers.utils import (
|
|
|
|
| 51 |
auto_docstring,
|
| 52 |
can_return_tuple,
|
| 53 |
is_torch_flex_attn_available,
|
|
|
|
| 704 |
# Model Heads
|
| 705 |
# =============================================================================
|
| 706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
@auto_docstring
|
| 708 |
class IQuestCoderForCausalLM(IQuestCoderPreTrainedModel, GenerationMixin):
|
| 709 |
"""IQuestCoder Model with a language modeling head on top for causal LM."""
|
|
|
|
| 754 |
output_hidden_states: Optional[bool] = None,
|
| 755 |
cache_position: Optional[torch.LongTensor] = None,
|
| 756 |
logits_to_keep: Union[int, torch.Tensor] = 0,
|
| 757 |
+
**kwargs
|
| 758 |
) -> CausalLMOutputWithPast:
|
| 759 |
r"""
|
| 760 |
Args:
|