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

v0.12.0 #131

Merged
merged 73 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5469f7e
:sparkles: :construction: Adding dropout to models
Sep 17, 2024
caa8b47
:white_check_mark: Added tests for dropout argument type.
Sep 17, 2024
d382509
:white_check_mark: Added test for dropout arg values
Sep 17, 2024
8696902
:recycle: Set default dropout to zero
Sep 17, 2024
d9500aa
:white_check_mark: Added tests for ConvBlock contents with dropout
Sep 17, 2024
be129a9
:white_check_mark: Added tests for ConvBlock call with dropout
Sep 17, 2024
0855c87
:recycle: Refactored instantiation
Sep 17, 2024
e11e99c
:white_check_mark: Added tests for dropout arg to DoubleConvBlock
Sep 17, 2024
2f33472
:white_check_mark: Added test for call method with dropout
Sep 17, 2024
7cadc49
:whiute_check_mark: Added tests for the contents
Sep 17, 2024
77c435b
:recycle: Set default dropout in conv res block to zero
Sep 19, 2024
971fa15
:white_check_mark: Type and value checked dropout arg
Sep 19, 2024
883a762
:white_check_mark: Added tests for call method of conv res block with…
Sep 19, 2024
862c0cb
:white_check_mark: Added test for conv res contents with dropout
Sep 19, 2024
fce3072
:white_check_mark: Made sure there are no dropouts in the residual block
Sep 19, 2024
5eee6a8
:memo: Uodated docstring
Sep 19, 2024
8c76125
:recycle: Refactored where dropout goes in double conv block
Sep 19, 2024
4778e21
:white_check_mark: Refactored tests
Sep 19, 2024
70266dd
:white_check_mark: Added tests for dropout arg types
Sep 19, 2024
fa6fc25
:white_check_mark: Added tests for dropout arg values
Sep 19, 2024
1985ddb
:recycle: Added type hint
Sep 19, 2024
1c5c19b
:white_check_mark: Added tests for the down block contents with dropout
Sep 21, 2024
1b28b52
:memo: Updated docstring
Sep 21, 2024
113f26b
:white_check_mark: Added tests for dropout argument type and values
Sep 21, 2024
1c78a55
:white_check_mark: Added tests for up block call with dropout
Sep 21, 2024
93bb4c2
:memo: Added tests for UpBlock contents with different dropout options
jdenholm Sep 23, 2024
46a75e2
:rotating_light:
jdenholm Sep 23, 2024
7a28dd1
:rotating_light:
jdenholm Sep 23, 2024
9bae94f
:rotating_light:
jdenholm Sep 23, 2024
2c11b93
:rotating_light:
jdenholm Sep 23, 2024
7d2191b
:rotating_light:
jdenholm Sep 23, 2024
6c561ba
:rotating_light:
jdenholm Sep 23, 2024
c13955d
:rotating_light:
jdenholm Sep 23, 2024
76695bd
:rotating_light:
jdenholm Sep 23, 2024
9d39060
:rotating_light:
jdenholm Sep 23, 2024
0a4ac28
:rotating_light:
jdenholm Sep 23, 2024
3c2da69
:rotating_light:
jdenholm Sep 23, 2024
f722e62
:rotating_light:
jdenholm Sep 23, 2024
5c520ee
:white_check_mark: Added type and value checks for dropout arg of UNe…
jdenholm Sep 23, 2024
46eb81f
:white_check_mark: Added test for UNetUpBlock call with dropout
jdenholm Sep 23, 2024
dfd086c
:white_check_mark: Added tests for UNetUpBlock contents with dropout
jdenholm Sep 23, 2024
a58eceb
:white_check_mark: Added tests for types and values of dropout argume…
jdenholm Sep 23, 2024
68e36ef
:sparkles: Added dropout argument to UNet
jdenholm Sep 23, 2024
b74e820
:white_check_mark: Added tests for unet call with dropout
Sep 24, 2024
0094033
:white_check_mark: Added tests for first conv contents with dropout
Sep 24, 2024
6a483be
:white_check_mark: Added tests for first conv contents with dropout
Sep 24, 2024
85b69af
:white_check_mark: Added tests for down block contents with dropout
Sep 24, 2024
c93351a
:white_check_mark: Added tests for unet down block contents with dropout
Sep 24, 2024
2ab21b8
:sparkles: Added dropout to Encoder2d
jdenholm Sep 24, 2024
92534d7
:white_check_mark: Added tests for dropout types and values
jdenholm Sep 24, 2024
9cd2f7e
:white_check_mark: Added tests for call method with dropout
jdenholm Sep 24, 2024
8febf98
:white_check_mark: Added tests for encoder call with dropout
jdenholm Sep 24, 2024
aa460e3
:sparkles: Added dropout option to encoder
Sep 25, 2024
2be55f0
:white_check_mark: Added tests for dropout argument types and values
Sep 25, 2024
fcc5239
:white_check_mark: Added tests for decoder call method with dropout
Sep 25, 2024
18eadcd
:white_check_mark: Added tests for decoder contents with dropout
Sep 25, 2024
833b4ba
:sparkles: Added dropout to AutoEncoder2d
Sep 25, 2024
64c6ce1
:white_check_mark: Added tests for dropout argument types and values
Sep 25, 2024
9ff8d08
:white_check_mark: Added tests for autoencoder call with dropout
Sep 25, 2024
272b84b
:white_check_mark: Added tests for encoder part of autoencoder conten…
Sep 25, 2024
ced20ee
:white_check_mark: Added tests for autoencder decoder contents with d…
Sep 25, 2024
ede3ce4
:sparkles: Added dropout option to VAE2d
Sep 25, 2024
798588b
:white_check_mark: Added tests for VAE2d dropout argument types
Sep 25, 2024
f0a7e86
:white_check_mark: Added tests for VAE2d dropout argument values
Sep 25, 2024
245bacd
:white_check_mark: Added tests for VAE2d call method with dropout
Sep 25, 2024
cf22fa1
:white_check_mark: Added tests for encoder contents with dropout
Sep 25, 2024
3f2b327
:white_check_mark: Tested decoder contents with dropout
Sep 25, 2024
22acf47
:memo: Updated UNet demo
jdenholm Sep 29, 2024
cf022aa
:memo: Updated autoencoder demo
jdenholm Sep 29, 2024
c778e89
:memo: Updated VAE demo
jdenholm Sep 29, 2024
d984efa
Merge pull request #130 from jdenholm/cnn-dropout
jdenholm Sep 29, 2024
4d642d2
:wrench:
jdenholm Sep 29, 2024
3f28f60
:memo:
jdenholm Sep 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Version0.11.1
## Version 0.12.0
- Added dropout option to all of the 2d conv blocks.
- Added dropout to ``UNet``, ``AutoEncoder2d`` and ``VAE2d``.

## Version 0.11.1
- Updated the ``UNet``'s docstring.

## Version 0.11.0
Expand Down
179 changes: 128 additions & 51 deletions demos/autoencoder-demo.ipynb

Large diffs are not rendered by default.

164 changes: 95 additions & 69 deletions demos/unet_semantic_segmentation_demo.ipynb

Large diffs are not rendered by default.

149 changes: 125 additions & 24 deletions demos/variational_autoencoder_demo.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "torch_tools"
version = "0.11.1"
version = "0.12.0"
description = "PyTorch and other tools"
authors = [
{ name="Jim Denholm", email="j.denholm.2017@gmail.com" },
Expand Down
2 changes: 2 additions & 0 deletions src/torch_tools/datasets/_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main dataset object for `torch_tools`."""

from typing import Sequence, Union, Optional, Tuple
from pathlib import Path

Expand All @@ -15,6 +16,7 @@


# pylint: disable=too-many-arguments, too-few-public-methods
# pylint: disable=too-many-positional-arguments


class DataSet(_BaseDataset):
Expand Down
4 changes: 3 additions & 1 deletion src/torch_tools/datasets/_shapes_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Synthetic dataset object."""

from typing import Tuple, Optional, Dict, Callable, List

from torch import from_numpy, Tensor # pylint: disable=no-name-in-module
Expand Down Expand Up @@ -56,7 +57,8 @@ class ShapesDataset(Dataset):

"""

def __init__( # pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments,too-many-arguments
def __init__(
self,
spot_prob: float = 0.5,
square_prob: float = 0.5,
Expand Down
9 changes: 8 additions & 1 deletion src/torch_tools/models/_autoencoder_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
process_boolean_arg,
process_2d_kernel_size,
process_2d_block_style_arg,
process_dropout_prob,
)

# pylint:disable=too-many-arguments
# pylint:disable=too-many-arguments, too-many-positional-arguments


class AutoEncoder2d(Module):
Expand Down Expand Up @@ -47,6 +48,9 @@ class AutoEncoder2d(Module):
block_style : str, optional
Style of convolutional blocks to use in the encoding and decoding
blocks. Use either ``"double_conv"`` or ``"conv_res"``.
dropout : float, optional
The dropout probability to apply at the output of the convolutional
blocks.


Notes
Expand Down Expand Up @@ -97,6 +101,7 @@ def __init__(
bilinear: bool = False,
kernel_size: int = 3,
block_style: str = "double_conv",
dropout: float = 0.25,
):
"""Build ``EncoderDecoder2d``."""
super().__init__()
Expand All @@ -109,6 +114,7 @@ def __init__(
process_negative_slope_arg(lr_slope),
process_2d_kernel_size(kernel_size),
block_style=process_2d_block_style_arg(block_style),
dropout=process_dropout_prob(dropout),
)

self.decoder = Decoder2d(
Expand All @@ -119,6 +125,7 @@ def __init__(
process_negative_slope_arg(lr_slope),
process_2d_kernel_size(kernel_size),
block_style=process_2d_block_style_arg(block_style),
dropout=process_dropout_prob(dropout),
)

def forward(
Expand Down
3 changes: 2 additions & 1 deletion src/torch_tools/models/_blocks_1d.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""One dimensional neural network blocks."""

from typing import List

from torch.nn import Module, Sequential, Linear, BatchNorm1d, Dropout
Expand All @@ -9,7 +10,7 @@
from torch_tools.models._argument_processing import process_dropout_prob
from torch_tools.models._argument_processing import process_negative_slope_arg

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments, too-many-positional-arguments


class DenseBlock(Sequential):
Expand Down
Loading
Loading