ValueError at LwF and CWRStar strategies #868
-
Hi again, I am trying to implement LwF and CWRStar strategies to my LSTM network with time series data, but I got an ValueError at both of them, where I think it's quite more related to Avalanche topic rather than pure PyTorch. LwFHere I got an error after the first experience.
# create scenario instance
generic_scenario = tensors_scenario(
train_tensors=[(X_train1, y_train1), (X_train2, y_train2), (X_train3, y_train3)],
test_tensors=[(X_test1, y_test1), (X_test2, y_test2), (X_test3, y_test3)],
task_labels=[0, 0, 0], # Task label of each train exp
complete_test_set_only=False
)
# split stream into train and test set
train_stream = generic_scenario.train_stream
test_stream = generic_scenario.test_stream
# model instantiation
model = RNN(input_size, hidden_size, num_layers, num_classes)
# Instantiate Continual learning strategy
strategy = LwF(
model, optimizer, criterion, train_mb_size=32, train_epochs=10,
eval_mb_size=32, alpha=[1, 1, 1], temperature=2)
results = []
# train and test epochs
for train_task in train_stream:
# training
strategy.train(train_task, num_workers=4)
# evaluate the model and store the results
results.append(strategy.eval(test_stream))
CWRStarHere I got error directly.
# model instantiation
model = RNN(input_size, hidden_size, num_layers, num_classes)
# Instantiate Continual learning strategy
strategy = CWRStar(
model, optimizer, criterion, train_mb_size=32, train_epochs=10,
eval_mb_size=32, cwr_layer_name="None")
results = []
# train and test epochs
for train_task in train_stream:
# training
strategy.train(train_task, num_workers=4)
# evaluate the model and store the results
results.append(strategy.eval(test_stream))
So here are my questions:
Thank you in advance 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have to look at your issues, but I can answer this:
Not really. LwF and CWRStar are designed for classification. You can probably design similar strategies for regression but they will be slightly different. |
Beta Was this translation helpful? Give feedback.
I have to look at your issues, but I can answer this:
Not really. LwF and CWRStar are designed for classification. You can probably design similar strategies for regression but they will be slightly different.