Update modeling.py
Browse files- modeling.py +3 -1
modeling.py
CHANGED
|
@@ -4,6 +4,7 @@ import torch.nn.functional as F
|
|
| 4 |
from torch.nn.attention import sdpa_kernel, SDPBackend
|
| 5 |
from transformers import PreTrainedModel
|
| 6 |
from .configuration import CustomConfig
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
class RotaryPositionalEncoding(nn.Module):
|
|
@@ -149,4 +150,5 @@ class CustomModel(PreTrainedModel):
|
|
| 149 |
|
| 150 |
def forward(self, tensor):
|
| 151 |
with torch.autocast('cuda', dtype=torch.bfloat16):
|
| 152 |
-
|
|
|
|
|
|
| 4 |
from torch.nn.attention import sdpa_kernel, SDPBackend
|
| 5 |
from transformers import PreTrainedModel
|
| 6 |
from .configuration import CustomConfig
|
| 7 |
+
from transformers.modeling_outputs import CausalLMOutput
|
| 8 |
|
| 9 |
|
| 10 |
class RotaryPositionalEncoding(nn.Module):
|
|
|
|
| 150 |
|
| 151 |
def forward(self, tensor):
|
| 152 |
with torch.autocast('cuda', dtype=torch.bfloat16):
|
| 153 |
+
logits = self.model(tensor)
|
| 154 |
+
return CausalLMOutput(logits=logits)
|