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

fixed the stem and forward pass #115

Merged
merged 7 commits into from
Jul 26, 2024
Merged

Conversation

mattersoflight
Copy link
Member

@mattersoflight mattersoflight commented Jul 26, 2024

  • Common stem for convnext and resnet.
  • Model made up of stem, encoder, and projection sub-graphs. Easier to compute embedding and projection.
  • Retain layernorm in the stem.
  • stem implements 4x downsampling.
  • output both projections and embedding.

@mattersoflight mattersoflight marked this pull request as ready for review July 26, 2024 21:43
@mattersoflight mattersoflight merged commit 240293c into infection_state Jul 26, 2024
1 of 2 checks passed
@mattersoflight mattersoflight deleted the infection_state_stem branch July 26, 2024 21:44
ziw-liu pushed a commit that referenced this pull request Jul 31, 2024
* updated prediction code

* updated predict code

* updated code

* fixed the stem and forward pass (#115)

* fixed the stem and forward pass

* update forward calls to encoder

* self.encoder -> self.model

* nits

* l2 normalize projections

* black compliance

* black compliance

* WIP: Save progress before merging

* updated contrastive.py

* stem update

* updated predict code

* Delete viscy/applications/contrastive_phenotyping/PCA.ipynb

* pushing dataloader test updated

* pca deleted

* training and dataloader test

* updated structure

* deleted files

* updated training merged files

* removed commented code

* removed uneeded code

* removed uneeded code

* removed comments

* snake_case

* fixed CI issues

* removed num_fovs

---------

Co-authored-by: Shalin Mehta <[email protected]>
ziw-liu added a commit that referenced this pull request Aug 2, 2024
* first draft of contrastive learning model

* fixed stem and projection head, drafted lightning module

* Contrastive_dataloader (#99)

* initial dataloader.py

* Update dataloader_test.py

* Update dataloader_test.py

* Update dataloader_test.py

* Update dataloader_test.py

* rename training script

* move contrastive network to viscy.representation module

* Update hcs.py

* refactored class names

* correct imports

* cleaner names for model arch and module

* new imports

* Fixed epoch loss logging and WandB integration in ContrastiveModule

* updated training_script.py

* Update hcs.py

* contrastive.py

* engine.py

* script to test data i/o speed from different filesystems

* moved applications folder to viscy.applications so that pip install -e . works.

* add resnet50 to ContrastiveEncoder

* rename training_script.py to training_script_resnet.py

* test dataloader on lustre and vast

* move training_script_resnet to viscy.applications so that `pip install -e .` works

* refined the tests for contrastive dataloader

* sbatch script for dataloader

* delete redundant module

* nits: updated the model construction of contrastive resnet encoder.

* Updated training script, HCS data handling, engine, and contrastive representation

* Fix normalization, visualization issues, logging and multi-channel prediction

* updated training and prediction

* update training and prediction script

* formatting

* combine the application directories

* lint

* replace notebook with script

* format script

* rename scripts conflicting with pytest

* lint application scripts

* do not filter all warnings

* log instead of print

* split data modules by task

* clean up imports

* update typing

* use pathlib

* remove redundant file

* updated predict.py

* better typing

* wip: triplet dataset

* avoid forward ref
this might increase code analysis time a tiny bit
but should not have any effect at runtime

* check that z range is valid
and fix indexing

* clean up and explain random sampling

* sample dict instead of tuple and include track index

* take out generic HCS methods for reuse

* implement TripletDataModule

* use new batch type in engine

* better typing

* read normalization metadata

* docstring for data module

* drop normalization metadata after transformation

* remove unused import

* fix initial crop size

* Infection state (#118)

* updated prediction code

* updated predict code

* updated code

* fixed the stem and forward pass (#115)

* fixed the stem and forward pass

* update forward calls to encoder

* self.encoder -> self.model

* nits

* l2 normalize projections

* black compliance

* black compliance

* WIP: Save progress before merging

* updated contrastive.py

* stem update

* updated predict code

* Delete viscy/applications/contrastive_phenotyping/PCA.ipynb

* pushing dataloader test updated

* pca deleted

* training and dataloader test

* updated structure

* deleted files

* updated training merged files

* removed commented code

* removed uneeded code

* removed uneeded code

* removed comments

* snake_case

* fixed CI issues

* removed num_fovs

---------

Co-authored-by: Shalin Mehta <[email protected]>

---------

Co-authored-by: Shalin Mehta <[email protected]>
Co-authored-by: Alishba Imran <[email protected]>
Co-authored-by: Alishba Imran <[email protected]>
Co-authored-by: Alishba Imran <[email protected]>
Co-authored-by: Duo Peng <[email protected]>
edyoshikun pushed a commit that referenced this pull request Aug 7, 2024
* first draft of contrastive learning model

* fixed stem and projection head, drafted lightning module

* Contrastive_dataloader (#99)

* initial dataloader.py

* Update dataloader_test.py

* Update dataloader_test.py

* Update dataloader_test.py

* Update dataloader_test.py

* rename training script

* move contrastive network to viscy.representation module

* Update hcs.py

* refactored class names

* correct imports

* cleaner names for model arch and module

* new imports

* Fixed epoch loss logging and WandB integration in ContrastiveModule

* updated training_script.py

* Update hcs.py

* contrastive.py

* engine.py

* script to test data i/o speed from different filesystems

* moved applications folder to viscy.applications so that pip install -e . works.

* add resnet50 to ContrastiveEncoder

* rename training_script.py to training_script_resnet.py

* test dataloader on lustre and vast

* move training_script_resnet to viscy.applications so that `pip install -e .` works

* refined the tests for contrastive dataloader

* sbatch script for dataloader

* delete redundant module

* nits: updated the model construction of contrastive resnet encoder.

* Updated training script, HCS data handling, engine, and contrastive representation

* Fix normalization, visualization issues, logging and multi-channel prediction

* updated training and prediction

* update training and prediction script

* formatting

* combine the application directories

* lint

* replace notebook with script

* format script

* rename scripts conflicting with pytest

* lint application scripts

* do not filter all warnings

* log instead of print

* split data modules by task

* clean up imports

* update typing

* use pathlib

* remove redundant file

* updated predict.py

* better typing

* wip: triplet dataset

* avoid forward ref
this might increase code analysis time a tiny bit
but should not have any effect at runtime

* check that z range is valid
and fix indexing

* clean up and explain random sampling

* sample dict instead of tuple and include track index

* take out generic HCS methods for reuse

* implement TripletDataModule

* use new batch type in engine

* better typing

* read normalization metadata

* docstring for data module

* drop normalization metadata after transformation

* remove unused import

* fix initial crop size

* Infection state (#118)

* updated prediction code

* updated predict code

* updated code

* fixed the stem and forward pass (#115)

* fixed the stem and forward pass

* update forward calls to encoder

* self.encoder -> self.model

* nits

* l2 normalize projections

* black compliance

* black compliance

* WIP: Save progress before merging

* updated contrastive.py

* stem update

* updated predict code

* Delete viscy/applications/contrastive_phenotyping/PCA.ipynb

* pushing dataloader test updated

* pca deleted

* training and dataloader test

* updated structure

* deleted files

* updated training merged files

* removed commented code

* removed uneeded code

* removed uneeded code

* removed comments

* snake_case

* fixed CI issues

* removed num_fovs

---------

Co-authored-by: Shalin Mehta <[email protected]>

---------

Co-authored-by: Shalin Mehta <[email protected]>
Co-authored-by: Alishba Imran <[email protected]>
Co-authored-by: Alishba Imran <[email protected]>
Co-authored-by: Alishba Imran <[email protected]>
Co-authored-by: Duo Peng <[email protected]>
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.

1 participant