Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with lstm_ae #13

Open
StefanBloemheuvel opened this issue Jul 18, 2023 · 1 comment
Open

error with lstm_ae #13

StefanBloemheuvel opened this issue Jul 18, 2023 · 1 comment

Comments

@StefanBloemheuvel
Copy link

When i try to run the lstm_ae i get the following error:

IndexError                                Traceback (most recent call last)
[c:\Users\sdblo\Mijn](file:///C:/Users/sdblo/Mijn) Drive\PhD\Publicaties\graph_node_autoencoder\sequitur_example.py in line 56
     [31](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=30) # torch.use_deterministic_algorithms(True)
     [32](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=31) 
     [33](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=32) # train_data, test_data = train_test_split(data, test_size=0.1, shuffle=False, random_state=42)
   (...)
     [53](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=52) 
     [54](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=53) # train_set = torch.tensor(train_data, dtype=torch.float32)
     [55](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=54) train_set = [torch.randn(10, 5, 5) for _ in range(100)]
---> [56](file:///c%3A/Users/sdblo/Mijn%20Drive/PhD/Publicaties/graph_node_autoencoder/sequitur_example.py?line=55) encoder, decoder, _, _ = quick_train(LSTM_AE, train_set, encoding_dim=64, verbose=True, epochs=500, )

File [c:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\sequitur\quick_train.py:76](file:///C:/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py:76), in quick_train(model, train_set, encoding_dim, verbose, lr, epochs, denoise, **kwargs)
     [74](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=73) def quick_train(model, train_set, encoding_dim, verbose=False, lr=1e-3,
     [75](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=74)                 epochs=50, denoise=False, **kwargs):
---> [76](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=75)     model = instantiate_model(model, train_set, encoding_dim, **kwargs)
     [77](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=76)     losses = train_model(model, train_set, verbose, lr, epochs, denoise)
     [78](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=77)     encodings = get_encodings(model, train_set)

File [c:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\sequitur\quick_train.py:16](file:///C:/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py:16), in instantiate_model(model, train_set, encoding_dim, **kwargs)
     [14](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=13) def instantiate_model(model, train_set, encoding_dim, **kwargs):
     [15](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=14)     if model.__name__ in ("LINEAR_AE", "LSTM_AE"):
---> [16](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=15)         return model(train_set[-1].shape[-1], encoding_dim, **kwargs)
     [17](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=16)     elif model.__name__ == "CONV_LSTM_AE":
     [18](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/quick_train.py?line=17)         if len(train_set[-1].shape) == 3: # 2D elements

File [c:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\sequitur\models\lstm_ae.py:87](file:///C:/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py:87), in LSTM_AE.__init__(self, input_dim, encoding_dim, h_dims, h_activ, out_activ)
     [83](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=82) super(LSTM_AE, self).__init__()
     [85](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=84) self.encoder = Encoder(input_dim, encoding_dim, h_dims, h_activ,
     [86](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=85)                        out_activ)
---> [87](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=86) self.decoder = Decoder(encoding_dim, input_dim, h_dims[::-1],
     [88](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=87)                        h_activ)

File [c:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\sequitur\models\lstm_ae.py:46](file:///C:/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py:46), in Decoder.__init__(self, input_dim, out_dim, h_dims, h_activ)
     [43](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=42) def __init__(self, input_dim, out_dim, h_dims, h_activ):
     [44](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=43)     super(Decoder, self).__init__()
---> [46](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=45)     layer_dims = [input_dim] + h_dims + [h_dims[-1]]
     [47](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=46)     self.num_layers = len(layer_dims) - 1
     [48](file:///c%3A/Users/sdblo/miniconda3/envs/tsl/lib/site-packages/sequitur/models/lstm_ae.py?line=47)     self.layers = nn.ModuleList()

IndexError: list index out of range
@SecantZhang
Copy link

same error here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants