-
Notifications
You must be signed in to change notification settings - Fork 321
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
Adding types to some of datamodules #462
Merged
Borda
merged 81 commits into
Lightning-Universe:master
from
briankosw:types/datamodules
Jan 20, 2021
Merged
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
34f5f07
Adding types to datamodules
briankosw 2b55b32
Fixing typing imports
briankosw ac3377d
Removing torchvision.transforms from return typing
briankosw a4c39c7
Remove more torchvision.transforms typing
briankosw ffa0cb9
Removing return typing
briankosw 5e6c5d4
Add `None` for optional arguments
briankosw 3a5a0ab
Remove unnecessary import
briankosw 30579ed
Remove unnecessary import
briankosw 5de590c
Merge branch 'types/datamodules' of https://github.com/briankosw/pyto…
briankosw c675931
Add `None` return type
briankosw 267649c
Add type for torchvision transforms
briankosw 3938fff
Adding types to datamodules
briankosw cae3f46
Fixing typing imports
briankosw 7af027e
Removing torchvision.transforms from return typing
briankosw 7bec605
Remove more torchvision.transforms typing
briankosw afbc918
Removing return typing
briankosw 17ce335
Add `None` for optional arguments
briankosw d09f98d
Remove unnecessary import
briankosw b61fdc0
Add `None` return type
briankosw f2f4305
Add type for torchvision transforms
briankosw cd09554
enable check
Borda 797a9d1
Merge branch 'types/datamodules' of https://github.com/briankosw/pyto…
briankosw 0fcd186
Adding types to datamodules
briankosw a430696
Fixing typing imports
briankosw a84551e
Removing torchvision.transforms from return typing
briankosw 685162c
Remove more torchvision.transforms typing
briankosw 0140837
Removing return typing
briankosw a6b8d4a
Add `None` for optional arguments
briankosw de35a55
Remove unnecessary import
briankosw f521b79
Add `None` return type
briankosw fa0d271
Add type for torchvision transforms
briankosw 0bc9f7b
Adding types to datamodules
briankosw 05fcef2
Fixing typing imports
briankosw d92604b
Removing torchvision.transforms from return typing
briankosw a9c641b
Removing return typing
briankosw 314329c
Add `None` return type
briankosw 14ea6b7
enable check
Borda e97332c
Merge branch 'types/datamodules' of https://github.com/briankosw/pyto…
briankosw 8a7c6f1
Adding types to datamodules
briankosw 3b0ee3c
Fixing typing imports
briankosw 3d1c9a1
Removing torchvision.transforms from return typing
briankosw 6cac909
Remove more torchvision.transforms typing
briankosw c1ea0fb
Removing return typing
briankosw c04caab
Add `None` for optional arguments
briankosw 5b6bf64
Remove unnecessary import
briankosw 7ce736d
Add `None` return type
briankosw 7309ade
Add type for torchvision transforms
briankosw cc154a7
Adding types to datamodules
briankosw cff7330
Fixing typing imports
briankosw 3bbc189
Removing torchvision.transforms from return typing
briankosw 5b2401b
Removing return typing
briankosw 7eb32b8
Add `None` return type
briankosw 47cca32
enable check
Borda 52e4811
Adding types to datamodules
briankosw 64f871e
Fixing typing imports
briankosw bf6ee1c
Removing torchvision.transforms from return typing
briankosw b5c6dcc
Removing return typing
briankosw 984a962
Add `None` return type
briankosw 7894471
Adding types to datamodules
briankosw 3443883
Fixing typing imports
briankosw 51f8f16
Removing torchvision.transforms from return typing
briankosw 3062dba
Removing return typing
briankosw 53ebe33
Add `None` return type
briankosw ec068e4
Merge branch 'types/datamodules' of https://github.com/briankosw/pyto…
briankosw c15efdb
Fix rebasing mistakes
briankosw 7bc0c37
Fix flake8
briankosw a5f3e4f
Fix yapf format
briankosw e0c05a2
Merge branch 'master' into types/datamodules
Borda bd97183
Merge branch 'master' into briankosw-types/datamodules
akihironitta b9c910d
Add types and skip mypy checks on some files
akihironitta 9e222d0
Fix setup.cfg
akihironitta 0c54fdd
Add missing import
akihironitta 8b2e196
isort
akihironitta 9c5dd5c
yapf
akihironitta c6c97e1
mypy please...
akihironitta 4ac8a5b
Please be quiet mypy and flake8
akihironitta e847ead
yapf...
akihironitta 1839438
Disable all of yapf, flake8, and mypy
akihironitta 097df6d
Use Callable
akihironitta 9e00c5d
Use Callable
akihironitta af563a5
Add missing import
akihironitta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from typing import Any, Optional, Union | ||
from typing import Any, Callable, Optional, Union | ||
|
||
from pl_bolts.datamodules.vision_datamodule import VisionDataModule | ||
from pl_bolts.datasets.mnist_dataset import BinaryMNIST | ||
|
@@ -76,7 +76,7 @@ def __init__( | |
"You want to use transforms loaded from `torchvision` which is not installed yet." | ||
) | ||
|
||
super().__init__( | ||
super().__init__( # type: ignore[misc] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mypy will raise errors without these |
||
data_dir=data_dir, | ||
val_split=val_split, | ||
num_workers=num_workers, | ||
|
@@ -98,7 +98,7 @@ def num_classes(self) -> int: | |
""" | ||
return 10 | ||
|
||
def default_transforms(self): | ||
def default_transforms(self) -> Callable: | ||
if self.normalize: | ||
mnist_transforms = transform_lib.Compose([ | ||
transform_lib.ToTensor(), transform_lib.Normalize(mean=(0.5, ), std=(0.5, )) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the record, I had a collision here between yapf and flake8. Lightning-AI/pytorch-lightning#5591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applying
yapf
will cause flake8's error[W503] line break before binary operator
if without these ignores.