You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error w/ training Mamba with ResNet Feature Extractor: RuntimeError: Function MambaInnerFnBackward returned an invalid gradient at index 6 - got [] but expected shape compatible with [10] #203
I want to use Mamba with a bunch of images, so I am using ResNet as a feature extractor. My mamba "wrapper class"'s init function looks like this:
self.feature_extractor = Feature_Extractor(feature_extractor)
self.mamba = Mamba(
d_model=feature_sizes[feature_extractor], # Model dimension d_model
d_state=d_state, # SSM state expansion factor
d_conv=d_conv, # Local convolution width
expand=expand, # Block expansion factor
bias=False,
)
Feature_Extractor is another class that is essentially just a ResNet without the last linear layer.
I am getting the error below:
Traceback (most recent call last):
File "/home/dana/test/train.py", line 372, in
loss = train(model, optimizer, criterion, train_loader, DEVICE)
File "/home/dana/test/utils.py", line 66, in train
loss.backward()
File "/home/dana.conda/envs/multitask2/lib/python3.10/site-packages/torch/_tensor.py", line 522, in backward
torch.autograd.backward(
File "/home/dana/.conda/envs/multitask2/lib/python3.10/site-packages/torch/autograd/init.py", line 266, in backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: Function MambaInnerFnBackward returned an invalid gradient at index 6 - got [] but expected shape compatible with [10]