Merged
Conversation
…ode, constants, return type
…ad code, use torch.abs
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Comprehensive cleanup of the phasefinder codebase: bug fixes, deduplication, type hints, packaging fixes, and CI/CD setup.
Changes
New files
phasefinder/constants.py— Shared constants (SAMPLE_RATE,N_FFT,HOP,FRAME_RATE,BEAT_ONSET_THRESHOLD,CLICK_SAMPLE_RATE)tests/test_weight_loading.py— Proper pytest tests for weight loading and constants.github/workflows/ci.yml— CI pipeline with lint and test jobsBug fixes (
predictor.py)if not beats:→if beats is None:(numpy arrays raise ValueError on truthiness)audio_with_clicks = np.array(...)(immediately overwritten)predict()now always returnsnp.ndarray(added.numpy()for unclean path)Bug fixes (
train.py)from dataset→from phasefinder.dataset.cuda()with.to(device)usingget_device()running_lossbug: trackedtotal_lossseparately from logging windowprint(args.use_attention)Bug fixes (
dataset.py)from utils.one_hots→from phasefinder.utils.one_hotsdevice='cuda'→device=Nonewith auto-detectionDeduplication
extract_beat_times()intophasefinder/postproc/__init__.py— replaces copy-pasted HMM → onset detection → cleaning pipeline frompredictor.pyandval.py_report_scores()helper inval.pyfor repeated averaging/printing blockframe_rate = 22050. / 512line inval.pyMinor fixes
decoder.py: Renamedself.relu→self.activation(it'snn.ELU())cleaner.py: Removed debug print and commented-out old thresholds, removed unusednudge()functionhmm.py:abs()→torch.abs()for consistencyinfer.py: Removed deadaudio_with_clicks = np.array(...)lineType hints
Added type annotations to all public function signatures across:
predictor.py,val.py,dataset.py,postproc/__init__.py,postproc/hmm.py,postproc/cleaner.py,utils/get_device.py,utils/get_weights.py,audio/log_filter.pyTest & import fixes
test_model.py,test_postproc.py,postproc_gridsearch.pyto usephasefinder.prefixpyproject.tomlwithtestpaths = ["tests"]Packaging
librosafromrequirements.txtandpyproject.tomlpyproject.toml[project.optional-dependencies] dev = ["pytest", "ruff"]CI/CD
line-length = 120,select = ["E", "F", "W", "I"]Code style
.pyfiles__init__.pyfilesVerification
pytest tests/ -v— 1 passed, 1 skipped (weight loading skipped without model files)ruff check .— all checks passedruff format --check .— all files formattedFRAME_RATE=43.066...extract_beat_timesimportable and functional