TorchStudio / torchstudio

IDE for PyTorch and its ecosystem
https://torchstudio.ai
MIT License
378 stars 27 forks source link

tatus message gets stuck on the Build script connected #45

Open aero-oli opened 1 year ago

aero-oli commented 1 year ago

when building a model, the status message gets stuck on the Build script connected, it's a custom model, on M1 mac. see log bellow

23:46:35.123 INFO starting TorchStudio 0.9.14 on "macOS 13.2" 23:46:35.809 INFO python check: "Checking Python version...\n\nChecking required packages...\n\nLoading PyTorch...\n\nListing devices...\n\n" "Ready (macOS-13.2.1-arm64-arm-64bit, Python 3.10.9, PyTorch 1.12.0, Devices: cpu \"CPU\" (FP32), mps \"Metal\" (FP32))\n" 23:46:35.831 WARNING QIODevice::read (QFile, "/Users/oliververity/Library/Application Support/JetBrains/PyCharm2022.3/options/file.template.settings.xml"): device not open 23:46:36.045 INFO checking notifications... 23:46:36.095 INFO inference: "Loading PyTorch...\n\n" "" 23:46:38.159 INFO inference: "Training script connected\n\n" "" 23:46:38.159 INFO inference: "Setting device...\n\n" "" 23:46:38.159 INFO inference: "Setting mode...\n\n" "" 23:47:15.925 INFO opening "/Users/oliververity/Documents/pedestrian-intent-prediction/ped-test.tsz" 23:47:15.986 INFO datasetload: "Loading PyTorch...\n\n" "" 23:47:16.470 INFO datasetload: "Dataset script connected\n\n" "" 23:47:16.472 INFO datasetload: "Loading dataset...\n\n" "" 23:47:17.708 INFO datasetload: "Processing...\n" "" 23:47:33.984 INFO datasetload: "Done!\n" "" 23:47:34.037 INFO datasetload: "" "Loading complete\n" 23:48:27.010 INFO build: "Model 1" "Loading PyTorch...\n\n" "" 23:48:27.737 INFO build: "Model 1" "Build script connected\n\n" "" 23:48:28.349 INFO build end: "Model 1" "" "" 23:50:43.374 INFO build: "Model 1" "Loading PyTorch...\n\n" "" 23:50:44.022 INFO build: "Model 1" "Build script connected\n\n" "" 23:50:44.575 INFO build end: "Model 1" "" "" 23:51:22.645 INFO build: "Model 1" "Loading PyTorch...\n\n" "" 23:51:23.089 INFO build: "Model 1" "Build script connected\n\n" "" 23:51:23.487 INFO build end: "Model 1" "" ""

aero-oli commented 1 year ago

for context here is the model

` import torch import torch.nn as nn import torch.nn.functional as F

from torch_geometric.nn import GCNConv
from torch_geometric_temporal.nn.recurrent import GCLSTM, GConvLSTM

filters = 32

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class social_stgcn(torch.nn.Module):
def __init__(self, input_feat=2, Conv_outputs=[5], LSTM_output=[5],
             K=1, linear_output=3):
    super(social_stgcn, self).__init__()

    self.input_feat = input_feat
    self.Conv_outputs = Conv_outputs
    self.LSTM_output = LSTM_output
    self.linear_output = linear_output
    self.K = K

    self.gcn1 = GCNConv(in_channels=self.input_feat,
                        out_channels=self.input_feat,
                        improved=True)
    self.gcn2 = GCNConv(in_channels=self.input_feat,
                        out_channels=self.input_feat,
                        improved=True)

    self.gclstm1 = GCLSTM(in_channels=self.input_feat,
                          out_channels=self.input_feat,
                          K=K, normalization="sym", bias=True)
    self.gclstm2 = GCLSTM(in_channels=self.input_feat,
                          out_channels=self.input_feat,
                          K=K, normalization="sym", bias=True)

    self.no_lstm = 5

    self.linear = nn.Linear(in_features=self.input_feat,
                            out_features=self.linear_output)

def forward(self, data, device):

    x, edge_index = data.x.cuda(), data.edge_index.cuda()

    # Zero padding the input to fit the input features
    x = torch.cat([x, torch.zeros(size=(self.input_feat - x.size()[0], x.size()[1]), device=device)], 0)
    x = torch.cat([x, torch.zeros(size=(x.size()[0], self.input_feat - x.size()[1]), device=device)], 1)

    # Initializing the training variables
    h = [None for i in range(self.no_lstm)]
    c = [None for i in range(self.no_lstm)]

    x = self.gcn1(x=x, edge_index=edge_index)
    x = F.relu(x)
    x = self.gcn2(x=x, edge_index=edge_index)
    x = F.relu(x)
    h[0], c[0] = self.gclstm1(x, edge_index, H=h[0], C=c[0])
    h[1], c[1] = self.gclstm2(h[0], edge_index, H=h[1], C=c[1])

    x = F.relu(h[1])

    return self.linear(x)

`