Proper way to define the parameters of AR1 strategy #861
-
Hello again, I am trying several continual learning strategies to figure out which one fits to our research. My code: # model instantiation
model = RNN(input_size, hidden_size, num_layers, num_classes)
# define optimizer and loss function for training
optimizer = SGD(model.parameters(), lr=0.001, momentum=0.9)
criterion = MSELoss()
# Instantiate Continual learning strategy
strategy = AR1(
model, optimizer, criterion, train_mb_size=32, train_epochs=5, eval_mb_size=32)
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)) Error message: /usr/local/lib/python3.7/dist-packages/avalanche/training/strategies/ar1.py:85: UserWarning: The AR1 strategy implementation is in an alpha stage and is not perfectly aligned with the paper implementation. Please use at your own risk!
warnings.warn("The AR1 strategy implementation is in an alpha stage "
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-37-1b523e793b17> in <module>()
7 # Instantiate Continual learning strategy
8 strategy = AR1(
----> 9 model, optimizer, criterion, train_mb_size=32, train_epochs=5, eval_mb_size=32)
10
11 results = []
1 frames
/usr/local/lib/python3.7/dist-packages/torch/optim/sgd.py in __init__(self, params, lr, momentum, dampening, weight_decay, nesterov)
82 def __init__(self, params, lr=required, momentum=0, dampening=0,
83 weight_decay=0, nesterov=False):
---> 84 if lr is not required and lr < 0.0:
85 raise ValueError("Invalid learning rate: {}".format(lr))
86 if momentum < 0.0:
TypeError: '<' not supported between instances of 'SGD' and 'float' I have no idea how to solve this. Should I use other optimizer? Do I have any data with float data type? What should I change here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @highclef . You can take a look at the signature of AR1 strategy here. As you can see, AR1 does not accept model or optimizer, since it uses its own (MobileNet with SGD). The strategy has been designed for that model and currently does not support any other architecture. |
Beta Was this translation helpful? Give feedback.
Hi @highclef . You can take a look at the signature of AR1 strategy here. As you can see, AR1 does not accept model or optimizer, since it uses its own (MobileNet with SGD). The strategy has been designed for that model and currently does not support any other architecture.