learnables / learn2learn

A PyTorch Library for Meta-learning Research
http://learn2learn.net
MIT License
2.61k stars 350 forks source link

How to use learn2learn task set with new data set? #375

Closed brando90 closed 1 year ago

brando90 commented 1 year ago

Say I have 3 splits of disjoint classes to create anew meta-learning data set (say in 3 folders with each folder having the class and the image files). I can lead each in a normal pytorch data set. How would i create a new l2l task set loader?

brando90 commented 1 year ago

The main idea is in this file: https://github.com/learnables/learn2learn/blob/master/learn2learn/vision/benchmarks/mini_imagenet_benchmark.py

but my understanding is to:

  1. get a normal pytorch data set e.g. https://github.com/learnables/learn2learn/blob/0b9d3a3d540646307ca5debf8ad9c79ffe975e1c/learn2learn/vision/datasets/mini_imagenet.py#L34
  2. wrap it in the l2l objects as in https://github.com/learnables/learn2learn/blob/master/learn2learn/vision/benchmarks/mini_imagenet_benchmark.py likely this step make sure the data transforms are set correctly. Also (likely) return the data sets & task transforms here for next step.
  3. then return task objects with each data set, each task transform (note the data transforms were already done to the data set objs) and then wrap it in the benchmark taskloader: https://github.com/learnables/learn2learn/blob/master/learn2learn/vision/benchmarks/__init__.py#L127
  4. now it should work.

so three files you need:

seba-1511 commented 1 year ago

Hello @brando90,

I recommend you read this tutorial, which goes into the details of task creation and task transforms. Also, feel free to post these support questions in our slack (we try to keep the issue tracker for implementation-related issues).

brando90 commented 1 year ago

Hello @brando90,

I recommend you read this tutorial, which goes into the details of task creation and task transforms. Also, feel free to post these support questions in our slack (we try to keep the issue tracker for implementation-related issues).

sounds good! If I may respectfully suggest we open a discussion forum for this repo, the issue with l2l slack is that the responses die after a while :(

Thanks for your patience seba!