Spaces:
Sleeping
Sleeping
Download model.py from CahilCuhela/JetEngineRUL-Predictor: direct link, hf CLI and curl.
- Browser
- Download file 694 Bytes
-
https://huggingface.co/spaces/CahilCuhela/JetEngineRUL-Predictor/resolve/main/model.py
- Command line
-
hf download hf://spaces/CahilCuhela/JetEngineRUL-Predictor/model.py
-
curl -L -o model.py https://huggingface.co/spaces/CahilCuhela/JetEngineRUL-Predictor/resolve/main/model.py
694 Bytes
| import torch | |
| from torch import nn | |
| class LSTMRegressor(nn.Module): | |
| def __init__(self, input_size = 24, hidden_size = 64, num_layers = 2, dropout = 0.2): | |
| super().__init__() | |
| self.lstm = nn.LSTM(input_size = input_size, | |
| hidden_size = hidden_size, | |
| num_layers = num_layers, | |
| dropout= dropout, | |
| batch_first = True) | |
| self.fc = nn.Linear(in_features = hidden_size, | |
| out_features = 1) | |
| def forward(self, x): | |
| out, _ = self.lstm(x) | |
| last_time_step = out[:, -1, :] | |
| out= self.fc(last_time_step) | |
| return out | |