Adapters
English
code
medical
dnnsdunca commited on
Commit
996b001
1 Parent(s): a2954b5

Create Models/audio_expert.py

Browse files
Files changed (1) hide show
  1. Models/audio_expert.py +16 -0
Models/audio_expert.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ import torch.nn.functional as F
4
+
5
+ class AudioExpert(nn.Module):
6
+ def __init__(self):
7
+ super(AudioExpert, self).__init__()
8
+ self.rnn = nn.LSTM(input_size=40, hidden_size=128, num_layers=2, batch_first=True)
9
+ self.fc1 = nn.Linear(128, 128)
10
+
11
+ def forward(self, x):
12
+ h0 = torch.zeros(2, x.size(0), 128).to(x.device)
13
+ c0 = torch.zeros(2, x.size(0), 128).to(x.device)
14
+ x, _ = self.rnn(x, (h0, c0))
15
+ x = F.relu(self.fc1(x[:, -1, :]))
16
+ return x