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

Enable tests for examples #123

Merged

Conversation

akihironitta
Copy link
Contributor

@akihironitta akihironitta commented Feb 15, 2021

What does this PR do?

This PR:

  • adds missing testing on flash_examples/.
    • note that we still skip some of the example tests due to the lack of computing resources. otherwise, it'll take too long to finish the tests.
  • (makes sure to use " instead of mix use with ' in examples for consistency.)

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 🙃


# 2. Create an ImageEmbedder with swav trained on imagenet.
# Check out SWAV: https://pytorch-lightning-bolts.readthedocs.io/en/latest/self_supervised_models.html#swav
embedder = ImageEmbedder(backbone="swav-imagenet", embedding_dim=128)

# 3. Generate an embedding from an image path.
embeddings = embedder.predict('data/hymenoptera_data/predict/153783656_85f9c3ac70.jpg')
embeddings = embedder.predict(["data/hymenoptera_data/predict/153783656_85f9c3ac70.jpg"])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should predict() accept str in addition to List[str]?

@akihironitta akihironitta marked this pull request as ready for review February 15, 2021 03:27
@codecov
Copy link

codecov bot commented Feb 15, 2021

Codecov Report

Merging #123 (c477464) into master (24c5b66) will decrease coverage by 0.50%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
- Coverage   87.39%   86.89%   -0.51%     
==========================================
  Files          49       49              
  Lines        1579     1579              
==========================================
- Hits         1380     1372       -8     
- Misses        199      207       +8     
Flag Coverage Δ
unittests 86.89% <ø> (-0.51%) ⬇️

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

Impacted Files Coverage Δ
flash/text/seq2seq/core/data.py 79.45% <0.00%> (-5.48%) ⬇️
flash/core/data/datamodule.py 97.77% <0.00%> (-2.23%) ⬇️
flash/vision/classification/data.py 83.33% <0.00%> (-2.00%) ⬇️

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 24c5b66...bf3c7fa. Read the comment docs.

@akihironitta akihironitta marked this pull request as draft February 15, 2021 03:34
@akihironitta akihironitta marked this pull request as ready for review February 15, 2021 05:09
@@ -53,13 +53,20 @@ def run_test(filepath):
"step,file",
[
("finetuning", "image_classification.py"),
# ("finetuning", "object_detection.py"), # TODO: takes too long.
Copy link
Member

Choose a reason for hiding this comment

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

would GPU help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I assume it would help. I cannot even run fintuning/translation.py locally (CPU, 16GB) due to the OOM error.

from flash.tabular import TabularClassifier, TabularData

# 1. Download the data
download_data("https://pl-flash-data.s3.amazonaws.com/titanic.zip", 'data/')
download_data("https://pl-flash-data.s3.amazonaws.com/titanic.zip", "data/")
Copy link
Member

Choose a reason for hiding this comment

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

lets cache the data folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be caching data/ directory already as I fixed it in #107.

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@kaushikb11 kaushikb11 merged commit a6edeab into Lightning-Universe:master Feb 17, 2021
@akihironitta akihironitta deleted the tests/enable-examples branch May 5, 2021 11:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants