Skip to content

DEV: Initial AVA implementation review #699

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

Open
wants to merge 150 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
0d6f66e
DEV: just to push on branch
marisbasha Sep 17, 2023
3aeb576
DEV: Initial notebook implementation VAE + AVA.
marisbasha Sep 1, 2023
9885e6b
DEV: Added training and validation inside model family definition.
marisbasha Sep 4, 2023
4de1b09
dev: Added suggestions and tested network forward result.
marisbasha Sep 17, 2023
d39f14a
Add src/vak/nets/ava.py
NickleDave Sep 29, 2023
aee76bf
Add src/vak/nn/loss/vae.py
NickleDave Sep 29, 2023
f132cb3
Import vae_loss and VaeLoss in src/vak/nn/loss/__init__.py
NickleDave Sep 29, 2023
f62ac36
Import Ava in src/vak/nets/__init__.py
NickleDave Sep 29, 2023
7bb5f42
Use itemgetter in src/vak/models/vae_model.py
NickleDave Sep 29, 2023
e1222c3
Add src/vak/models/ava.py
NickleDave Sep 29, 2023
1828ae7
Remove use of itemgetter in src/vak/models/vae_model.py
NickleDave Sep 29, 2023
8766862
Make changes to src/vak/nets/ava.py suggested during meeting
NickleDave Sep 29, 2023
dd9949d
Add comma at end of __all__ in src/vak/nets/__init__.py
NickleDave Sep 29, 2023
96359bb
Rename vae_loss, VaeLoss -> vae_elbo_loss, VaeElboLoss
NickleDave Sep 29, 2023
68fd024
Fix reference to Ava, VaeLoss -> VaeElboLoss in src/vak/models/ava.py
NickleDave Sep 29, 2023
d24bd5f
DEV: Added .vscode to gitignore, renamed Ava to AVA in nets and added…
marisbasha Oct 8, 2023
56dab3b
Put .vscode under IDE in .gitignore
NickleDave Oct 18, 2023
0e0588f
Remove test_vae.ipynb
NickleDave Oct 18, 2023
077bf99
Uncomment from __future__ import annotations in vak/nets/ava.py
NickleDave Oct 18, 2023
6e118fd
Remove `src` from comment in vak/nets/ava.py
NickleDave Oct 18, 2023
6b4d16f
Use network attributes 'encoder' and 'decoder' in VAEModel
NickleDave Oct 18, 2023
b26766a
Modify AVA network to have input_shape parameter
NickleDave Oct 18, 2023
9425df2
Modify vak.models.get to handle VAEModel
NickleDave Oct 18, 2023
7c600d6
Add variable + comments in nets.AVA.__init__
NickleDave Oct 19, 2023
a4579f8
Fix how we handle VAEModel in vak.models.get
NickleDave Oct 19, 2023
1c529e5
Fix how VAEModel unpacks 'x' in training_step and validation_step
NickleDave Oct 19, 2023
d3b6220
Add train-ava.ipynb
NickleDave Oct 19, 2023
60a9b8b
Move test_vae.ipynb to src/scripts
NickleDave Sep 29, 2023
fc61d10
Have nets.Ava use input_shape parameter, revise code slightly
NickleDave Nov 21, 2023
70c0c13
(Re)capitalize AVA in vak/nets/ava.py
NickleDave Nov 21, 2023
69ba261
Rewrite AVA.__init__ to use `encoder_channels` + `out_channels` inste…
NickleDave Nov 21, 2023
e6d0447
Use torch.flatten in AVA.encode
NickleDave Nov 21, 2023
94b7487
Further revise src/vak/nets/ava.py
NickleDave Nov 22, 2023
b2b854d
Fix default learning rate in src/vak/models/ava.py
NickleDave Nov 22, 2023
f420268
Add missing 'in_features = out_features' in AVA.__init__
NickleDave Nov 22, 2023
6b0f576
Fix AVA.decode to use self.x_shape
NickleDave Nov 22, 2023
88b001e
Use input_shape in AVA.decode
NickleDave Nov 22, 2023
c4fdd3a
WIP: Add tests/test_nets/test_ava.py
NickleDave Dec 28, 2023
d28ab0b
WIP: Add docstrings in src/vak/nets/ava.py
NickleDave Dec 28, 2023
911013c
Remove unused import, extra line break at end of tests/test_nets/test…
NickleDave Dec 28, 2023
0cb4933
Cast AVA attributes in_channels and x_dim to be ints
NickleDave Dec 28, 2023
94fe92b
Add newline at end of src/vak/models/vae_model.py
NickleDave Dec 28, 2023
e0fa087
Fix tests in tests/test_nets/test_ava.py
NickleDave Dec 28, 2023
9bdf7bb
Add src/vak/transforms/defaults/vae.py
NickleDave Jan 2, 2024
6d85336
Fix typo in docstring in src/vak/transforms/defaults/parametric_umap.py
NickleDave Jan 2, 2024
81ce104
Modify src/vak/transforms/defaults/get.py to handle VAEModel
NickleDave Jan 2, 2024
7ba9481
Clean up docstrings in src/vak/datasets/parametric_umap/metadata.py
NickleDave Jan 2, 2024
75c72a0
Revise docstrings in src/vak/prep/parametric_umap/parametric_umap.py
NickleDave Jan 2, 2024
8339c9b
WIP: Add src/vak/datasets/vae/
NickleDave Jan 2, 2024
630c942
WIP: Add src/vak/prep/vae/
NickleDave Jan 2, 2024
87d4097
WIP: Add src/vak/train/vae.py
NickleDave Jan 2, 2024
78c7f74
Add src/vak/datasets/validators.py with validators for metadata
NickleDave Jan 2, 2024
0902f14
Use datasets/validators in src/vak/datasets/frame_classification/meta…
NickleDave Jan 2, 2024
dd1a6e6
Clean up names in docstrings in src/vak/datasets/frame_classification…
NickleDave Jan 2, 2024
1361f03
Further fix docstrings + use datasets.validators in src/vak/datasets/…
NickleDave Jan 3, 2024
4928091
Further fixes to docstring in src/vak/datasets/frame_classification/m…
NickleDave Jan 3, 2024
78cd1e6
Fix docstrings, use datasets.validators in src/vak/datasets/vae/metad…
NickleDave Jan 3, 2024
b215a77
Import vae in src/vak/datasets/__init__.py
NickleDave Jan 3, 2024
fd7a8db
Fix names in src/vak/prep/parametric_umap/parametric_umap.py
NickleDave Jan 3, 2024
0b2d7f9
WIP: Add src/vak/prep/vae/vae.py
NickleDave Jan 3, 2024
4a0123c
Import vae module in src/vak/prep/__init__.py
NickleDave Jan 3, 2024
8ec3b1e
Add vae-window and vae-segment to DATASET_TYPE_FUNCTION_MAP in vae.pr…
NickleDave Jan 3, 2024
9557a98
WIP: Add vae to src/vak/prep/prep_.py
NickleDave Jan 3, 2024
5056f38
Add imports in src/vak/datasets/vae/__init__.py
NickleDave Jan 3, 2024
7e837d7
Fix up src/vak/datasets/vae/window_dataset.py
NickleDave Jan 3, 2024
d01e1dd
Fix call to prep_vae_dataset in src/vak/prep/prep_.py
NickleDave Jan 3, 2024
980bf83
WIP: Add src/vak/prep/vae/segment_vae.py
NickleDave Jan 3, 2024
136ea66
WIP: Add src/vak/prep/vae/window_vae.py
NickleDave Jan 3, 2024
169bdb7
Rewrite prep_vae_dataset to call prep_segment_vae_dataset or prep_win…
NickleDave Jan 3, 2024
ce17828
Fixing up src/vak/prep/vae/segment_vae.py
NickleDave Jan 3, 2024
388bd39
Fixing up src/vak/prep/vae/window_vae.py
NickleDave Jan 3, 2024
dd3f4f9
Fixing up src/vak/prep/vae/vae.py
NickleDave Jan 3, 2024
21fc4c1
Add `is_valid_shape` to src/vak/datasets/validators.py
NickleDave Jan 3, 2024
9bedc6c
Make shape attribute optional in src/vak/datasets/vae/metadata.py
NickleDave Jan 3, 2024
d190a5f
Fix how we handle shape metadata in src/vak/prep/vae/vae.py
NickleDave Jan 3, 2024
5785275
Return shape from src/vak/prep/vae/segment_vae.py
NickleDave Jan 3, 2024
ea2ea19
Remove unused variable in src/vak/prep/vae/segment_vae.py
NickleDave Jan 3, 2024
a033f9c
Fix type annotations / docstring in src/vak/prep/unit_dataset/unit_da…
NickleDave Jan 3, 2024
f1756c1
Fix wording of error messages in src/vak/prep/parametric_umap/paramet…
NickleDave Jan 3, 2024
ea03232
Fix wording of error messages in src/vak/prep/vae/segment_vae.py
NickleDave Jan 3, 2024
c3c5eb7
Add/use prep_frame_label_vecs parameter in src/vak/prep/frame_classif…
NickleDave Jan 3, 2024
6f74673
Fixing src/vak/prep/vae/window_vae.py
NickleDave Jan 3, 2024
41e08a3
Fix how we detect vae dataset type in src/vak/prep/prep_.py
NickleDave Jan 3, 2024
4ef737f
Fix DATASET_TYPES to match what we use elsewhere in src/vak/prep/vae/…
NickleDave Jan 3, 2024
232ad22
Add dataset_type attribute to vae.datasets.Metadata, add validator fo…
NickleDave Jan 3, 2024
6da7c33
Add missing args to prep_vae_dataset in src/vak/prep/prep_.py
NickleDave Jan 3, 2024
6bd41ff
Fix how we detect dataset type in src/vak/prep/vae/vae.py, pass datas…
NickleDave Jan 3, 2024
520bb4e
Remove spect_output_dir parameter from prep_window_ave_dataset, inste…
NickleDave Jan 3, 2024
a9decc3
Make fixes in src/vak/train/vae.py
NickleDave Jan 4, 2024
9ca3023
Have src/vak/train/train_.py call train_vae_model as appropriate
NickleDave Jan 4, 2024
e4e34fa
Add 'subset' parameter to SegmentDataset, revise docstring
NickleDave Jan 4, 2024
761acf8
Revise docstrings in src/vak/datasets/vae/window_dataset.py
NickleDave Jan 4, 2024
4c5fde9
Fix up src/vak/train/vae.py
NickleDave Jan 4, 2024
f0bcc43
Fix Metadata class used in src/vak/datasets/vae/segment_dataset.py
NickleDave Jan 7, 2024
5214625
Fix up src/vak/train/vae.py
NickleDave Jan 7, 2024
e5dd712
Add type annotations in src/vak/prep/spectrogram_dataset/spect.py
NickleDave Jan 8, 2024
5b9637d
WIP: Add max_dur and target_shape parameters in src/vak/prep/unit_dat…
NickleDave Jan 8, 2024
bde3b2f
WIP: Add max_dur and target_shape parameters to src/vak/prep/vae/segm…
NickleDave Jan 8, 2024
148157e
Fix how we interpolate to use replacement for interp2d
NickleDave Jan 8, 2024
fae14cf
Set defaults for max_dur and target_shape to None in prep_segment_vae…
NickleDave Jan 9, 2024
7861159
Add max_dur and target_shape parameters to prep_vae_dataset
NickleDave Jan 9, 2024
bedc211
Add max_dur and target_shape parameters to prep_, pass to prep_vae_da…
NickleDave Jan 9, 2024
74bf7fe
Add context_s, max_dur, and target_shape attributes to PrepConfig
NickleDave Jan 9, 2024
6d749d9
Add context_s, max_dur, and target_shape options to PREP section in c…
NickleDave Jan 9, 2024
86d5f00
Fix cli/prep so we pass new options into vak.prep
NickleDave Jan 9, 2024
9ccfabd
Modify default for PrepConfig.context_s to be 0.005, not None (caused…
NickleDave Jan 9, 2024
c425b21
Remove return_latent_rec parameter from vae_elbo_loss, make functiona…
NickleDave Jan 10, 2024
1a3cee1
Fix returned values and what we pass to loss in src/vak/models/vae_mo…
NickleDave Jan 10, 2024
6b2e689
Add/use normalize parameter in src/vak/prep/unit_dataset/unit_dataset.py
NickleDave Jan 10, 2024
b8be3a9
Add/use normalize parameter in src/vak/prep/vae/segment_vae.py
NickleDave Jan 10, 2024
ef8964e
Add/use normalize parameter in src/vak/prep/vae/vae.py
NickleDave Jan 10, 2024
f8fbca9
Add/use normalize parameter in src/vak/prep/prep_.py
NickleDave Jan 10, 2024
1df6af2
Add normalize attribute to PrepConfig in src/vak/config/prep.py
NickleDave Jan 10, 2024
2ac7c9a
Add normalize option to PREP section in src/vak/config/valid.toml
NickleDave Jan 10, 2024
41bd1e1
Pass normalize argument into vak.prep in src/vak/cli/prep.py
NickleDave Jan 10, 2024
2540114
Fix spectrogram_from_segment to use min value of spectrogram as fill …
NickleDave Jan 10, 2024
f1fc26b
Compute L2 values in vae elbo loss the same way AVA does
NickleDave Jan 10, 2024
60fadbe
Rewrite src/vak/prep/unit_dataset/unit_dataset.py so we can use mean …
NickleDave Jan 11, 2024
869359d
Add min_val, max_val, and normalize attributes to SpectParamsConfig
NickleDave Jan 11, 2024
7ad1d07
Add min_val, max_val, and normalize parameters to spectrogram functio…
NickleDave Jan 11, 2024
8a8fdd1
Remove using spectrograms mean as fill value in src/vak/prep/unit_dat…
NickleDave Jan 11, 2024
6ae1e3b
Remove normalize attribute from PrepConfig
NickleDave Jan 11, 2024
32a0d47
Add options to SPECT_PARAMS in valid_toml, remove normalize option fr…
NickleDave Jan 11, 2024
dd9fcf5
Remove normalize paramter from src/vak/prep/vae/vae.py
NickleDave Jan 11, 2024
23e8244
Remove normalize parameter from src/vak/prep/vae/segment_vae.py
NickleDave Jan 11, 2024
89ec944
Fix up remove normalize from src/vak/prep/vae/vae.py
NickleDave Jan 11, 2024
694a30b
Remove normalize parameter from src/vak/prep/prep_.py
NickleDave Jan 11, 2024
18a5029
Remove normalize arg (no longer exists) in call to prep in src/vak/cl…
NickleDave Jan 11, 2024
22c71cc
Fix use of finfo in src/vak/prep/spectrogram_dataset/spect.py
NickleDave Jan 11, 2024
0696e56
Fix how we get/use fill/pad value in src/vak/prep/unit_dataset/unit_d…
NickleDave Jan 11, 2024
de4e58f
Rename 'unit_dataset' -> 'segment_dataset' in prep/
NickleDave Jan 11, 2024
a546eeb
Fix up rename 'unit_dataset' -> 'segment_dataset' in prep/
NickleDave Jan 11, 2024
cfb23c4
Rename prep/parametric_umap/dataset_arrays.py -> prep/segment_dataset…
NickleDave Jan 11, 2024
7f70781
Import make_splits function in src/vak/prep/segment_dataset/__init__.py
NickleDave Jan 11, 2024
e5361ce
Use segment_dataset.make_splits in src/vak/prep/parametric_umap/param…
NickleDave Jan 11, 2024
dfbcba7
Use segment_dataset.make_splits function in src/vak/prep/vae/segment_…
NickleDave Jan 11, 2024
c001b24
Fixup use make_splits in src/vak/prep/parametric_umap/parametric_umap.py
NickleDave Jan 11, 2024
c61a881
Add src/vak/prep/segment_dataset/learncurve.py
NickleDave Jan 19, 2024
b2e166a
Use segment_dataset.learncurve.make_subsets_from_dataset_df in src/va…
NickleDave Jan 19, 2024
73108a9
Remove unused imports in src/vak/prep/segment_dataset/learncurve.py
NickleDave Jan 19, 2024
575ff6e
Import learncurve in src/vak/prep/segment_dataset/__init__.py
NickleDave Jan 19, 2024
00cabc1
Add newline in src/vak/prep/segment_dataset/learncurve.py
NickleDave Jan 19, 2024
8f3a609
WIP: Add tests/test_prep/test_segment_dataset/
NickleDave Jan 19, 2024
e640ef4
Fix imports in src/vak/prep/parametric_umap/__init__.py
NickleDave Jan 19, 2024
a4272aa
Add ref to AVA code in src/vak/models/ava.py
NickleDave Jan 19, 2024
9e608e9
WIP: Revise docstrings in src/vak/nets/ava.py
NickleDave Jan 19, 2024
5550cb8
WIP: Revise docstrings in src/vak/nn/loss/vae.py
NickleDave Jan 19, 2024
3b8f98a
Add AVA configs in tests/data_for_tests/configs
NickleDave Mar 1, 2024
36a0a0d
WIP: Add tests/test_models/test_vae.py
NickleDave Apr 13, 2024
d09d577
WIP: Add tests/test_datasets/test_vae/
NickleDave Apr 13, 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# IDE
.idea
.vscode

# Jupyter
.ipynb_checkpoints/
Expand All @@ -26,4 +27,7 @@ tests/data_for_tests/generated/

# coverage / pytest-cov
.coverage
coverage.xml
coverage.xml

#nox
.nox/
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none"
}
49 changes: 49 additions & 0 deletions src/scripts/test_vae.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from src.vak.nets.ava import Ava\n",
"import torch"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"x_shape = (3, 128, 512)\n",
"input = torch.zeros(x_shape)\n",
"net = Ava(x_shape=(x_shape[1], x_shape[2]))\n",
"output, _ = net.forward(input)\n",
"assert output.shape == x_shape, 'Error'"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
3 changes: 3 additions & 0 deletions src/vak/cli/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def prep(toml_path):
test_dur=cfg.prep.test_dur,
train_set_durs=cfg.prep.train_set_durs,
num_replicates=cfg.prep.num_replicates,
context_s=cfg.prep.context_s,
max_dur=cfg.prep.max_dur,
target_shape=cfg.prep.target_shape,
)

# use config and section from above to add dataset_path to config.toml file
Expand Down
72 changes: 70 additions & 2 deletions src/vak/config/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def is_valid_duration(instance, attribute, value):
"""validator for dataset split durations"""
if type(value) not in {int, float}:
raise TypeError(
f"invalid type for {attribute} of {instance}: {type(value)}. Type should be float or int."
f"invalid type for {attribute.name} of {instance}: {type(value)}. Type should be float or int."
)

if value == -1: # specifies "use the remainder of the dataset"
Expand All @@ -34,7 +34,7 @@ def is_valid_duration(instance, attribute, value):

if not value >= 0:
raise ValueError(
f"value specified for {attribute} of {instance} must be greater than or equal to zero, was {value}"
f"value specified for {attribute.name} of {instance} must be greater than or equal to zero, was {value}"
)


Expand All @@ -60,6 +60,25 @@ def are_valid_dask_bag_kwargs(instance, attribute, value):
)


def is_valid_target_shape(instance, attribute, value):
"""validator for target shape"""
if not isinstance(value, (tuple, list)):
raise TypeError(
f"invalid type for {attribute.name} of {instance}: {type(value)}. Type should be tuple or list."
)

if not all([isinstance(val, int) for val in value]):
raise ValueError(
f"All values in {attribute.name} of {instance} should be integers"
)

if not len(value) == 2:
raise ValueError(
f"{attribute.name} of {instance} should have length 2: "
f"(number of frequency bins, number of time bins). "
f"Length was: {len(value)}"
)

@attr.s
class PrepConfig:
"""class to represent [PREP] section of config.toml file
Expand Down Expand Up @@ -125,6 +144,31 @@ class PrepConfig:
in a learning curve. Each replicate uses a different
randomly drawn subset of the training data (but of the same duration).
Default is None. Required if config file has a learncurve section.
context_s : float
Number of seconds of "context" around a segment to
add, i.e., time before and after the onset
and offset respectively. Default is 0.005s,
5 milliseconds. This parameter is only used for
Parametric UMAP and segment-VAE datasets.
max_dur : float
Maximum duration for segments.
If a float value is specified,
any segment with a duration larger than
that value (in seconds) will be omitted
from the dataset. Default is None.
This parameter is only used for
vae-segment datasets.
target_shape : tuple
Of ints, (target number of frequency bins,
target number of time bins).
Spectrograms of units will be reshaped
by interpolation to have the specified
number of frequency and time bins.
The transformation is only applied if both this
parameter and ``max_dur`` are specified.
Default is None.
This parameter is only used for
vae-segment datasets.
"""

data_dir = attr.ib(converter=expanded_user_path)
Expand Down Expand Up @@ -195,6 +239,30 @@ def is_valid_input_type(self, attribute, value):
validator=validators.optional(instance_of(int)), default=None
)

context_s = attr.ib(
default=0.005
)
@context_s.validator
def is_valid_context_s(self, attribute, value):
if not isinstance(value, float):
raise TypeError(
f"Value for {attribute.name} should be float but type was: {type(value)}"
)
if not value >= 0.:
raise ValueError(
f"Value for {attribute.name} should be greater than or equal to 0., "
f"but was: {value}"
)

max_dur = attr.ib(
validator=validators.optional(instance_of(float)), default=None
)
target_shape = attr.ib(
converter=converters.optional(tuple),
validator=validators.optional(is_valid_target_shape),
default=None
)

def __attrs_post_init__(self):
if self.audio_format is not None and self.spect_format is not None:
raise ValueError("cannot specify audio_format and spect_format")
Expand Down
35 changes: 34 additions & 1 deletion src/vak/config/spect_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def freq_cutoffs_validator(instance, attribute, value):
)


VALID_TRANSFORM_TYPES = {"log_spect", "log_spect_plus_one"}
VALID_TRANSFORM_TYPES = {
"log", "log_spect", "log_spect_plus_one"
}


def is_valid_transform_type(instance, attribute, value):
Expand Down Expand Up @@ -57,6 +59,24 @@ class SpectParamsConfig:
audio_path_key : str
key for accessing path to source audio file for spectogram in files.
Default is 'audio_path'.
min_val : float, optional
Minimum value to allow in spectrogram.
All values less than this will be set to this value.
This operation is applied *after* the transform
specified by ``transform_type``.
Default is None.
max_val : float, optional
Maximum value to allow in spectrogram.
All values greater than this will be set to this value.
This operation is applied *after* the transform
specified by ``transform_type``.
Default is None.
normalize : bool
If True, min-max normalize the spectrogram.
Normalization is done *after* the transform
specified by ``transform_type``, and *after*
the ``min_val`` and ``max_val`` operations.
Default is False.
"""

fft_size = attr.ib(converter=int, validator=instance_of(int), default=512)
Expand All @@ -79,3 +99,16 @@ class SpectParamsConfig:
freqbins_key = attr.ib(validator=instance_of(str), default="f")
timebins_key = attr.ib(validator=instance_of(str), default="t")
audio_path_key = attr.ib(validator=instance_of(str), default="audio_path")
min_val = attr.ib(
validator=validators.optional(instance_of(float)),
default=None
)
max_val = attr.ib(
validator=validators.optional(instance_of(float)),
default=None
)
normalize = attr.ib(
validator=instance_of(bool),
default=False,
)

6 changes: 6 additions & 0 deletions src/vak/config/valid.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ val_dur = 15
test_dur = 30
train_set_durs = [ 4.5, 6.0 ]
num_replicates = 2
context_s = 0.005
max_dur = 0.2
target_shape = [128, 128]

[SPECT_PARAMS]
fft_size = 512
Expand All @@ -32,6 +35,9 @@ spect_key = 's'
freqbins_key = 'f'
timebins_key = 't'
audio_path_key = 'audio_path'
min_val = -6.0
max_val = 0.0
normalize = true

[TRAIN]
model = 'TweetyNet'
Expand Down
4 changes: 2 additions & 2 deletions src/vak/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from . import frame_classification, parametric_umap
from . import frame_classification, parametric_umap, vae

__all__ = ["frame_classification", "parametric_umap"]
__all__ = ["frame_classification", "parametric_umap", "vae"]
Loading
Loading