Upload modeling_te3s_head.py with huggingface_hub
Browse files- modeling_te3s_head.py +3 -4
modeling_te3s_head.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
-
from __future__ import annotations
|
| 2 |
-
|
| 3 |
import torch
|
| 4 |
import torch.nn as nn
|
|
|
|
| 5 |
from transformers import PreTrainedModel, PretrainedConfig
|
| 6 |
|
| 7 |
|
|
@@ -44,8 +43,8 @@ class TextEmbedding3SmallSentimentHead(PreTrainedModel):
|
|
| 44 |
def forward(
|
| 45 |
self,
|
| 46 |
inputs_embeds: torch.FloatTensor,
|
| 47 |
-
labels: torch.LongTensor
|
| 48 |
-
**
|
| 49 |
):
|
| 50 |
logits = self.net(inputs_embeds)
|
| 51 |
loss = None
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import torch.nn as nn
|
| 3 |
+
from typing import Optional
|
| 4 |
from transformers import PreTrainedModel, PretrainedConfig
|
| 5 |
|
| 6 |
|
|
|
|
| 43 |
def forward(
|
| 44 |
self,
|
| 45 |
inputs_embeds: torch.FloatTensor,
|
| 46 |
+
labels: Optional[torch.LongTensor] = None,
|
| 47 |
+
**kwargs,
|
| 48 |
):
|
| 49 |
logits = self.net(inputs_embeds)
|
| 50 |
loss = None
|