Skip to content

Commit

Permalink
Deprecate non-v3.0.0 input signals (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdatkinson authored Sep 17, 2024
1 parent a24caf3 commit 17273de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions nam/train/_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ class VersionAndName(NamedTuple):
# From most- to the least-recently-released:
INPUT_BASENAMES = (
VersionAndName(Version(3, 0, 0), "input.wav", {"v3_0_0.wav"}),
# ==================================================================================
# These are deprecated and will be removed in v0.11. If you still want them, you'll
# need to write an extension.
VersionAndName(Version(2, 0, 0), "v2_0_0.wav", None),
VersionAndName(Version(1, 1, 1), "v1_1_1.wav", None),
VersionAndName(Version(1, 0, 0), "v1.wav", None),
VersionAndName(PROTEUS_VERSION, "Proteus_Capture.wav", None),
# ==================================================================================
)

LATEST_VERSION = INPUT_BASENAMES[0]
11 changes: 10 additions & 1 deletion nam/train/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def assign_hash_v4(path) -> Hash:
f"Input file at {input_path} cannot be recognized as any known version!"
)
strong_match = False

return version, strong_match


Expand Down Expand Up @@ -776,7 +777,15 @@ def _check_data(
else:
print(f"Checks not implemented for input version {input_version}; skip")
return None
return f(input_path, output_path, delay, silent)
out = f(input_path, output_path, delay, silent)
# Issue 442: Deprecate inputs
if input_version.major != 3:
print(
f"Input version {input_version} is deprecated and will be removed in "
"version 0.11 of the trainer. To continue using it, you must ignore checks."
)
out.passed = False
return out


def _get_wavenet_config(architecture):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_nam/test_train/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def test_detect_input_version_v1_1_1_strong(self):
def test_detect_input_version_v2_0_0_strong(self):
self._t_detect_input_version_strong(Version(2, 0, 0))

@requires_v3_0_0
def test_detect_input_version_v3_0_0_strong(self):
self._t_detect_input_version_strong(Version(3, 0, 0))

@requires_v1_0_0
def test_detect_input_version_v1_0_0_weak(self):
self._t_detect_input_version_weak(Version(1, 0, 0))
Expand All @@ -68,6 +72,10 @@ def test_detect_input_version_v1_1_1_weak(self):
def test_detect_input_version_v2_0_0_weak(self):
self._t_detect_input_version_weak(Version(2, 0, 0))

@requires_v3_0_0
def test_detect_input_version_v3_0_0_weak(self):
self._t_detect_input_version_weak(Version(3, 0, 0))

@classmethod
def _customize_resource(cls, path_in, path_out):
x, info = wav_to_np(path_in, info=True)
Expand Down

0 comments on commit 17273de

Please sign in to comment.