pytorch-maml | An Implementation of Model-Agnostic Meta-Learning | Machine Learning library
kandi X-RAY | pytorch-maml Summary
kandi X-RAY | pytorch-maml Summary
An Implementation of Model-Agnostic Meta-Learning in PyTorch with Torchmeta
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Evaluate the model
- Calculates the inner loss of the outer loss
- Adapts the model according to the given inputs
- Convert tensors to tensors
- Compute the accuracy
- Create a model with the given name
- A model convolutional model
- Convolution model
- Generate a MetaML model
- Train the model
- A MetaMLPosteroid model
pytorch-maml Key Features
pytorch-maml Examples and Code Snippets
Community Discussions
Trending Discussions on pytorch-maml
QUESTION
I was going through the omniglot maml example and saw that they have net.train()
at the top of their testing code. This seems like a mistake since that means the stats from each task at meta-testing is shared:
ANSWER
Answered 2021-Nov-25 at 19:54TLDR: Use mdl.train()
since that uses batch statistics (but inference will not be deterministic anymore). You probably won't want to use mdl.eval()
in meta-learning.
BN intended behaviour:
- Importantly, during inference (eval/testing) running_mean, running_std is used - that was calculated from training(because they want a deterministic output and to use estimates of the population statistics).
- During training the batch statistics is used but a population statistic is estimated with running averages. I assume the reason batch_stats is used during training is to introduce noise that regularizes training (noise robustness)
- in meta-learning I think using batch statistics is the best during testing (and not calculate the running means) since we are supposed to be seeing new /tasksdistribution anyway. Price we pay is loss of determinism. Could be interesting just out of curiosity what the accuracy is using population stats estimated from meta-trian.
This is likely why I don't see divergence in my testing with the mdl.train()
.
So just make sure you use mdl.train()
(since that uses batch statistics https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html#torch.nn.BatchNorm2d) but that either the new running stats that cheat aren't saved or used later.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pytorch-maml
Python 3.6 or above
PyTorch 1.5
Torchvision 0.6
Torchmeta 1.4.6
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page