Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a base model for LFR #70

Merged
merged 6 commits into from
Jul 16, 2024

Conversation

fernandoGubiMarques
Copy link
Collaborator

Describe your changes

This branch contains the implementation of a base model for the Learning from Random Projectors pretext task for self-supervised learning.

This model requires two torch.nn.ModuleList. For convenience, a RepeatedModuleList module is also implemented to instantiate multiple modules of the same class.

Additionally, it contains an MLP class (unrelated to LFR) to facilitate the creation of future simple prediction and projection heads.

Issue ticket number and link (If apply)

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests to this funtionality.
  • All tests are passing.
  • I have updated the documentation as needed.
  • I have followed the project's coding guidelines.

Copy link
Collaborator

@GabrielBG0 GabrielBG0 left a comment

Choose a reason for hiding this comment

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

Some changes are needed before merging.

You should also relocate your nets to the specific use case it is intended to have, e.g. image, time series etc...
Take a look in the new model organization.

A module list with the same module `cls`, instantiated `size` times.
"""

def __init__(self, size, cls, *args, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Define types for __init__ parameters

minerva/models/nets/lfr.py Outdated Show resolved Hide resolved
minerva/models/nets/mlp.py Outdated Show resolved Hide resolved
@GabrielBG0 GabrielBG0 self-assigned this Jul 5, 2024
@GabrielBG0
Copy link
Collaborator

@fernandoGubiMarques Forgot to include in the review, but if you could add the new models to the models/README.md would be nice too

@fernandoGubiMarques
Copy link
Collaborator Author

Neither LFR or MLP have a specific use, so I'm not sure where you want me to put them. LearningFromRandomnessModel is similar in nature with SimpleSupervisedModel, which is also outside any submodules. At any rate, the typing mismatches have been resolved.

Copy link
Collaborator

@GabrielBG0 GabrielBG0 left a comment

Choose a reason for hiding this comment

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

LGTM

@GabrielBG0
Copy link
Collaborator

Code looks good but i would like @otavioon 's opinion on where to put the models

minerva/models/README.md Show resolved Hide resolved
minerva/models/nets/mlp.py Outdated Show resolved Hide resolved
@otavioon
Copy link
Collaborator

Please move minerva/models/nets/lfr.py to minerva/models/ssl/lfr.py.

@GabrielBG0 GabrielBG0 requested a review from otavioon July 12, 2024 15:16
Copy link
Collaborator

@otavioon otavioon left a comment

Choose a reason for hiding this comment

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

LGTM

@otavioon otavioon merged commit abea98f into discovery-unicamp:main Jul 16, 2024
1 check passed
@fernandoGubiMarques fernandoGubiMarques deleted the lfr-base branch July 22, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants