MAML Pytorch
Elegant PyTorch implementation of paper Model-Agnostic Meta-Learning (MAML)
Install / Use
npx skills add dragen1860/MAML-PytorchInstalls into whichever agent you are using.
README
MAML-Pytorch
PyTorch implementation of the supervised learning experiments from the paper: Model-Agnostic Meta-Learning (MAML).
Version 1.0: Both
MiniImagenetandOmniglotDatasets are supported! Have Fun~
Version 2.0: Re-write meta learner and basic learner. Solved some serious bugs in version 1.0.
For Tensorflow Implementation, please visit official HERE and simplier version HERE.
For First-Order Approximation Implementation, Reptile namely, please visit HERE.

Platform
- python: 3.x
- Pytorch: 0.4+
MiniImagenet
Howto
For 5-way 1-shot exp., it allocates nearly 6GB GPU memory.
miniimagenet/
├── images
├── n0210891500001298.jpg
├── n0287152500001298.jpg
...
├── test.csv
├── val.csv
└── train.csv
- modify the
pathinminiimagenet_train.py:
mini = MiniImagenet('miniimagenet/', mode='train', n_way=args.n_way, k_shot=args.k_spt,
k_query=args.k_qry,
batchsz=10000, resize=args.imgsz)
...
mini_test = MiniImagenet('miniimagenet/', mode='test', n_way=args.n_way, k_shot=args.k_spt,
k_query=args.k_qry,
batchsz=100, resize=args.imgsz)
to your actual data path.
- just run
python miniimagenet_train.pyand the running screenshot is as follows:
If your reproducation perf. is not so good, maybe you can enlarge your training epoch to get longer training. And MAML is notorious for its hard training. Therefore, this implementation only provide you a basic start point to begin your research.
and the performance below is true and achieved on my machine.
Benchmark
| Model | Fine Tune | 5-way Acc. | | 20-way Acc.| | |-------------------------------------|-----------|------------|--------|------------|--------| | | | 1-shot | 5-shot | 1-shot | 5-shot | | Matching Nets | N | 43.56% | 55.31% | 17.31% | 22.69% | | Meta-LSTM | | 43.44% | 60.60% | 16.70% | 26.06% | | MAML | Y | 48.7% | 63.11% | 16.49% | 19.29% | | Ours | Y | 46.2% | 60.3% | - | - |
Ominiglot
Howto
run python omniglot_train.py, the program will download omniglot dataset automatically.
decrease the value of args.task_num to fit your GPU memory capacity.
For 5-way 1-shot exp., it allocates nearly 3GB GPU memory.
Refer to this Rep.
@misc{MAML_Pytorch,
author = {Liangqu Long},
title = {MAML-Pytorch Implementation},
year = {2018},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/dragen1860/MAML-Pytorch}},
commit = {master}
}
Related Skills
mcp
Use the `mcp_perplexity-ask_perplexity_search` tools to answer questions. You should use this instead of the `web_search` tool because it is a lot more accurate.
practical-power-systems-synthesis
This skill enables synthesis in the domain of power-systems (engineering). It represents research-level-level expertise and is designed for production use in research, industry, and educational contexts. Use this skill when you need to perform synthesis operations related to power-systems.
semi-supervised-optogenetics-testing
This skill enables testing in the domain of optogenetics (neuroscience). It represents intermediate-level expertise and is designed for production use in research, industry, and educational contexts. Use this skill when you need to perform testing operations related to optogenetics.
data-mining-interpretation-fundamental
This skill enables interpretation in the domain of data-mining (data-science). It represents fundamental-level expertise and is designed for production use in research, industry, and educational contexts. Use this skill when you need to perform interpretation operations related to data-mining.
