Spaces:
Sleeping
Sleeping
Update src/model_def.py
Browse files- src/model_def.py +0 -4
src/model_def.py
CHANGED
|
@@ -2,8 +2,6 @@ import torch
|
|
| 2 |
import torch.nn as nn
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
-
# Positional Encoding class
|
| 6 |
-
def class (rename to PositionalEncoding)
|
| 7 |
class PositionalEncoding(nn.Module):
|
| 8 |
def __init__(self, d_model, max_len=32):
|
| 9 |
super().__init__()
|
|
@@ -17,8 +15,6 @@ class PositionalEncoding(nn.Module):
|
|
| 17 |
def forward(self, x):
|
| 18 |
return x + self.pe[:, :x.size(1)].to(x.device)
|
| 19 |
|
| 20 |
-
# Transformer emotion classifier
|
| 21 |
-
def class (rename to EmotionTransformer)
|
| 22 |
class EmotionTransformer(nn.Module):
|
| 23 |
def __init__(self, vocab_size, embed_dim=64, num_heads=4, num_classes=None):
|
| 24 |
super().__init__()
|
|
|
|
| 2 |
import torch.nn as nn
|
| 3 |
import numpy as np
|
| 4 |
|
|
|
|
|
|
|
| 5 |
class PositionalEncoding(nn.Module):
|
| 6 |
def __init__(self, d_model, max_len=32):
|
| 7 |
super().__init__()
|
|
|
|
| 15 |
def forward(self, x):
|
| 16 |
return x + self.pe[:, :x.size(1)].to(x.device)
|
| 17 |
|
|
|
|
|
|
|
| 18 |
class EmotionTransformer(nn.Module):
|
| 19 |
def __init__(self, vocab_size, embed_dim=64, num_heads=4, num_classes=None):
|
| 20 |
super().__init__()
|