\n\n--------------------------------------------------------------------------------\n\n[](https://travis-ci.com/learnables/learn2learn)\n\nlearn2learn is a PyTorch library for meta-learning implementations.\n\nThe goal of meta-learning is to enable agents to *learn how to learn*.\nThat is, we would like our agents to become better learners as they solve more and more tasks.\nFor example, the animation below shows an agent that learns to run after a only one parameter update.\n\n
\n\n**Features**\n\nlearn2learn provides high- and low-level utilities for meta-learning.\nThe high-level utilities allow arbitrary users to take advantage of exisiting meta-learning algorithms.\nThe low-level utilities enable researchers to develop new and better meta-learning algorithms.\n\nSome features of learn2learn include:\n\n* Modular API: implement your own training loops with our low-level utilities.\n* Provides various meta-learning algorithms (e.g. MAML, FOMAML, MetaSGD, ProtoNets, DiCE)\n* Task generator with unified API, compatible with torchvision, torchtext, torchaudio, and cherry.\n* Provides standardized meta-learning tasks for vision (Omniglot, mini-ImageNet), reinforcement learning (Particles, Mujoco), and even text (news classification).\n* 100% compatible with PyTorch -- use your own modules, datasets, or libraries!\n\n# Installation\n\n~~~bash\npip install learn2learn\n~~~\n\n# API Demo\n\nThe following is an example of using the high-level MAML implementation on MNIST.\nFor more algorithms and lower-level utilities, please refer to the [documentation](http://learn2learn.net/docs/learn2learn/) or the [examples](https://github.com/learnables/learn2learn/tree/master/examples).\n\n~~~python\nimport learn2learn as l2l\n\nmnist = torchvision.datasets.MNIST(root=\"/tmp/mnist\", train=True)\n\nmnist = l2l.data.MetaDataset(mnist)\ntask_generator = l2l.data.TaskGenerator(mnist,\n ways=3,\n classes=[0, 1, 4, 6, 8, 9],\n tasks=10)\nmodel = Net()\nmaml = l2l.algorithms.MAML(model, lr=1e-3, first_order=False)\nopt = optim.Adam(maml.parameters(), lr=4e-3)\n\nfor iteration in range(num_iterations):\n learner = maml.clone() # Creates a clone of model\n adaptation_task = task_generator.sample(shots=1)\n\n # Fast adapt\n for step in range(adaptation_steps):\n error = compute_loss(adaptation_task)\n learner.adapt(error)\n\n # Compute evaluation loss\n evaluation_task = task_generator.sample(shots=1,\n task=adaptation_task.sampled_task)\n evaluation_error = compute_loss(evaluation_task)\n\n # Meta-update the model parameters\n opt.zero_grad()\n evaluation_error.backward()\n opt.step()\n~~~\n\n### Acknowledgements\n\n1. The RL environments are adapted from Tristan Deleu's [implementations](https://github.com/tristandeleu/pytorch-maml-rl) and from the ProMP [repository](https://github.com/jonasrothfuss/ProMP/). Both shared with permission, under the MIT License.",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "https://github.com/learnables/learn2learn/archive/0.0.4.1.zip",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/learnables/learn2learn",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "learn2learn",
"package_url": "https://pypi.org/project/learn2learn/",
"platform": "",
"project_url": "https://pypi.org/project/learn2learn/",
"project_urls": {
"Download": "https://github.com/learnables/learn2learn/archive/0.0.4.1.zip",
"Homepage": "https://github.com/learnables/learn2learn"
},
"release_url": "https://pypi.org/project/learn2learn/0.0.4.1/",
"requires_dist": null,
"requires_python": "",
"summary": "PyTorch Meta-Learning Framework for Researchers",
"version": "0.0.4.1"
},
"last_serial": 5834115,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "eec687d404a924c125813d0ea9fde0d7",
"sha256": "b11d395bb869525f670c41d227dc97fac3f87a6de668731a203d822a53cc5a08"
},
"downloads": -1,
"filename": "learn2learn-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "eec687d404a924c125813d0ea9fde0d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1367,
"upload_time": "2019-05-08T16:37:11",
"url": "https://files.pythonhosted.org/packages/7a/03/726a924b4ccde231f9d223872b962447dc1cad3bd3bfe3096621eceb4a26/learn2learn-0.0.1.tar.gz"
}
],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "0b1ab2d4f2089bb727ef9a2effe2cb8e",
"sha256": "6baa9795580c47731b602b0387c1448be24443353eb403dcbacc5b2af7fd99f1"
},
"downloads": -1,
"filename": "learn2learn-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "0b1ab2d4f2089bb727ef9a2effe2cb8e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20114,
"upload_time": "2019-08-13T05:42:53",
"url": "https://files.pythonhosted.org/packages/92/42/ad0c64fd5dda78bdcf476ac97fc49dca84248156e2190c03c807b30f58a0/learn2learn-0.0.2.tar.gz"
}
],
"0.0.4": [
{
"comment_text": "",
"digests": {
"md5": "c594b859e11fd87ef631c8ff785d0f41",
"sha256": "2848943968deeb39fd747991b5c3a7e84edb0486f908ee6aa877be4d9b472f4c"
},
"downloads": -1,
"filename": "learn2learn-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "c594b859e11fd87ef631c8ff785d0f41",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23954,
"upload_time": "2019-09-12T05:12:44",
"url": "https://files.pythonhosted.org/packages/84/19/7b49dfb8958443ae97f2a714d5e7fbe3bcb4509d9234af04e4c10eb9aa20/learn2learn-0.0.4.tar.gz"
}
],
"0.0.4.1": [
{
"comment_text": "",
"digests": {
"md5": "5c56ebebdc4a63c660992dd3b6fbdc92",
"sha256": "e765d874315a3f8db579a247a53d1760c6a842ed77b6a9309503668c9e188323"
},
"downloads": -1,
"filename": "learn2learn-0.0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "5c56ebebdc4a63c660992dd3b6fbdc92",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25804,
"upload_time": "2019-09-16T06:07:53",
"url": "https://files.pythonhosted.org/packages/b5/eb/1a198a8061529e8f2b82682af0dc2bcf06a90776d498f8434c563f1c4001/learn2learn-0.0.4.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "5c56ebebdc4a63c660992dd3b6fbdc92",
"sha256": "e765d874315a3f8db579a247a53d1760c6a842ed77b6a9309503668c9e188323"
},
"downloads": -1,
"filename": "learn2learn-0.0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "5c56ebebdc4a63c660992dd3b6fbdc92",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25804,
"upload_time": "2019-09-16T06:07:53",
"url": "https://files.pythonhosted.org/packages/b5/eb/1a198a8061529e8f2b82682af0dc2bcf06a90776d498f8434c563f1c4001/learn2learn-0.0.4.1.tar.gz"
}
]
}