Closed Jeong-Bin closed 1 year ago
Hello @Jeong-Bin,
Method 3 is correct. Try using maml.clone(first_order=True)
when testing. Or, you can reduce the number of adaptation steps (at the price of performance).
How much GPU memory do you have? If you have more than 1 GPU, you can use model.features = torch.nn.DataParallel(model.features)
to distribute the activations on the GPUs.
@seba-1511 Thanks! My GPU is RTX 3090 Ti with 20GB memory. I'll try your solution.
Additionally, I referred to 'adaptation steps' in MAML paper. In section A.1. Classification of the paper, authors use 10 gradient steps at test time. Is the gradient step means adaptation step?
Yes, gradient steps are adaptation steps.
All right, thank you for your help! Have a nice day😊
Hi, I'm using l2l to create large MAML model. However, I have a question regarding the usage of
l2l.vision.models.ResNet12
orWRN28
. I tried the following 3 methods.In
Method 1
, ErrorRuntimeError: only batches of spatial targets supported (3D tensors) but got targets of size: : [5]
occurred. Also, when I modified code tolambda x: x.view(-1, 256)
andtorch.nn.Linear(256, ways)
,RuntimeError: mat1 and mat2 shapes cannot be multiplied (1260x84 and 256x5)
occurred.Method 2
worked well, but its test accuracy was lower than basic MAML model. I used following code for basic MAML.Method 3
worked well during training, but I encounteredOutOfMemoryError
in testing. (Actually, the training was very slow.)What is the right way, and what should I modify? Or is there any other way to make a large MAML model?
I set the training and testing configurations as follows: