Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

[PoC] Add MetaLearning support through learn2learn#737

Merged
tchaton merged 63 commits into
masterfrom
learn2learn
Sep 20, 2021
Merged

[PoC] Add MetaLearning support through learn2learn#737
tchaton merged 63 commits into
masterfrom
learn2learn

Conversation

@tchaton
Copy link
Copy Markdown
Contributor

@tchaton tchaton commented Sep 6, 2021

What does this PR do?

Here is the PR from the learn2learn side: learnables/learn2learn#257

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 6, 2021

Codecov Report

Merging #737 (fd2cce5) into master (c2095d3) will decrease coverage by 0.43%.
The diff coverage is 76.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #737      +/-   ##
==========================================
- Coverage   90.21%   89.77%   -0.44%     
==========================================
  Files         199      201       +2     
  Lines       10688    11011     +323     
==========================================
+ Hits         9642     9885     +243     
- Misses       1046     1126      +80     
Flag Coverage Δ
unittests 89.77% <76.58%> (-0.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
flash/core/data/data_module.py 94.50% <ø> (ø)
flash/pointcloud/detection/model.py 82.25% <ø> (ø)
flash/pointcloud/segmentation/model.py 76.13% <ø> (ø)
flash/image/data.py 86.66% <22.22%> (-8.79%) ⬇️
...h/image/classification/integrations/learn2learn.py 54.79% <54.79%> (ø)
flash/image/classification/adapters.py 82.02% <82.02%> (ø)
flash/core/classification.py 94.11% <83.33%> (-1.72%) ⬇️
flash/image/classification/model.py 76.59% <84.21%> (-0.33%) ⬇️
flash/core/adapter.py 94.44% <100.00%> (+0.44%) ⬆️
flash/core/data/data_pipeline.py 95.81% <100.00%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2095d3...fd2cce5. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 😃

Comment thread flash/core/utilities/providers.py Outdated
Comment thread flash/image/classification/adapters.py Outdated
Copy link
Copy Markdown
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a task, real example, competition to test it on?

@pietrolesci
Copy link
Copy Markdown
Contributor

pietrolesci commented Sep 7, 2021

Adding to @Borda's comment, an easy way to test whether it's working properly is to replicate the examples in this folder of the l2l library (note: link to vision examples). As soon as the discussion around the API is addressed, I can help replicating some examples

@mergify mergify Bot added the has conflicts label Sep 7, 2021
@mergify mergify Bot removed the has conflicts label Sep 7, 2021
Copy link
Copy Markdown
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 😃

Comment thread flash/core/data/process.py
Comment thread flash/image/classification/adapters.py Outdated
def __init__(self, task: AdapterTask, backbone: torch.nn.Module, head: torch.nn.Module):
super().__init__()

self._task = NoModule(task)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just move out the base *_step implementations to a mixin to just inherit the behaviour rather than have a reference to the task?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure to understand you. I did it this way, so we can use Task.training_step(self.task, batch, batch_idx) in the training_step of the adapter.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we could just move the Task.*_step methods out somehwere so that they can be included in the base task but also in adapters. That way the base adapter and base task could both have the base step methods and you could just do super().*_step to get access to it.

Comment thread flash/image/classification/adapters.py
Comment thread flash/image/classification/adapters.py
Copy link
Copy Markdown
Contributor

@pietrolesci pietrolesci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, looking great!

Comment thread flash/image/classification/adapters.py
Comment thread flash/image/classification/adapters.py Outdated
Comment thread flash/image/classification/adapters.py Outdated
Comment thread flash/image/classification/adapters.py Outdated
Comment thread flash/image/classification/adapters.py Outdated
Comment thread flash/core/utilities/imports.py Outdated
Comment thread requirements/datatype_image_extras.txt Outdated
@mergify mergify Bot removed the has conflicts label Sep 13, 2021
Comment thread flash/image/classification/model.py Outdated
Comment thread flash/image/classification/adapters.py
Comment thread flash/image/classification/model.py Outdated
@mergify mergify Bot removed the has conflicts label Sep 20, 2021
Copy link
Copy Markdown
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😃

Comment thread requirements/datatype_image_extras.txt Outdated
Comment thread .azure-pipelines/gpu-tests.yml Outdated
@tchaton tchaton merged commit 991fdf0 into master Sep 20, 2021
@tchaton tchaton deleted the learn2learn branch September 20, 2021 12:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants