microsoft / nni

An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
https://nni.readthedocs.io
MIT License
13.88k stars 1.81k forks source link

Anyone have some idea of time series forecasting problem using DARTS strategy over the search space of Recurrent neural networks? #5770

Open franciszh0716 opened 2 months ago

franciszh0716 commented 2 months ago

Describe the issue: I go through different 3 types of Neural Networks for the forecasting problem. All of them have the similar structure: Recurrent layer, and two dense layer. However when I tried with just modify the Recurrent layer to Layerchoice, there always have some problem like

File ~/Documents/GitHub/NAS/nni/nni/nas/experiment/experiment.py:270, in NasExperiment.start(self, port, debug, run_mode) ... 1079 f"For unbatched 2-D input, hx should also be 2-D but got {hx.dim()}-D tensor") 1080 hx = hx.unsqueeze(1) 1081 else:

RuntimeError: For unbatched 2-D input, hx should also be 2-D but got 3-D tensor.

Where

X_train, X_test, y_train, y_test = train_test_split(X_tensor, Y_tensor, random_state = 0) print(X_train.shape, X_test.shape, y_train.shape, y_test.shape)

is

torch.Size([9656, 300]) torch.Size([3219, 300]) torch.Size([9656]) torch.Size([3219]) and the Dataloader is set as train_dataset = TensorDataset(X_train, y_train.unsqueeze(1)) test_dataset = TensorDataset(X_test, y_test.unsqueeze(1)) train_loader = DataLoader(train_dataset, batch_size=128, shuffle=True) test_loader = DataLoader(test_dataset, batch_size=128, shuffle=False)

I'm not sure what is the exact issue happening here.

Environment:

Configuration:

Log message:

How to reproduce it?: