Repository navigation
Add DeepFilterNet speech enhancement model #100
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
Merged
Merged
Changes from 27 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
46d170c
Add DeepFilterNet Swift model + CLI integration
kylehowells 747a579
Match libDF ERB band feature extraction in DeepFilterNet Swift
kylehowells 8274dd6
DeepFilterNet Swift: low-latency streaming refactor and offline fast …
kylehowells e4afad0
DeepFilterNet Swift: optimize streaming grouped conv path and parity-…
kylehowells 579d2f3
Checkpoint before DeepFilterNet streaming profiling
kylehowells a6b442f
DeepFilterNet Swift: add stream profiling and reduce host-copy overhead
kylehowells dbdc10b
Optimize DeepFilterNet Swift hot path with parity-safe conv caching
kylehowells bb0b162
DeepFilterNet Swift: pre-transpose GRU weights and cache streamer loo…
kylehowells 6392034
DeepFilterNet: test compiled streaming infer path (regressed)
kylehowells 2507857
DeepFilterNet: remove compiled streaming flag and experiment path
kylehowells 7129054
DeepFilterNet Swift: static streaming histories and materialization t…
kylehowells 6d4de8b
DeepFilterNet Swift: speed up offline filter path
kylehowells 6619c65
PR cleanup: add DeepFilterNet CI coverage and ignore local artifacts
kylehowells 2a33939
Add DeepFilterNet STS model-routing regression test
kylehowells 02b3a8d
Add DeepFilterNet golden-audio regression test with spectral comparison
kylehowells b9a17d4
DeepFilterNet V1: add support with Accelerate-optimized grouped GRU
kylehowells 9ba616e
DeepFilterNet V2/V3: speed up offline GRU with Accelerate
kylehowells 6eb8f24
DeepFilterNet: split 2980-line monolith into 5 focused files
kylehowells ffb774c
Update DeepFilterNet README and main repo README
kylehowells 5124723
Add doc comments to DeepFilterNet public API
kylehowells b2c5386
Remove benchmark scripts from tracking and gitignore scripts/
kylehowells 0dab925
Switch default model repo to mlx-community/DeepFilterNet-mlx
kylehowells 7025d68
Fix stale iky1e repo references in doc comment and README
kylehowells 80d241d
Code review fixes: Sendable, dead code, magic numbers, README defaults
kylehowells fa690df
Revert unrelated LFM temperature default fix in CLI README
kylehowells 04814d1
Add comment explaining SeparationMode reuse in DeepFilterNet CLI
kylehowells 7d38bbd
Merge STS tests into CI test matrix, remove separate job
kylehowells 92e22c9
Merge origin/main: resolve conflicts with G2P, StyleTTS2, KittenTTS a…
kylehowells b8989bd
Drop unused CI test matrix to match origin/main
kylehowells 73ed10b
Merge branch 'main' into main
76fb8ec
Add real-time DeepFilterNet audio demo CLI tool
kylehowells 5e4b024
Create DeepFilterNetStreamingBenchmark.swift
kylehowells 90a878d
Update .gitignore
kylehowells b2c7063
Revert "Add real-time DeepFilterNet audio demo CLI tool"
kylehowells f865ee5
Revert "Create DeepFilterNetStreamingBenchmark.swift"
kylehowells 0071d6a
Merge branch 'main' into main
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 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
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
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
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
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
125 changes: 125 additions & 0 deletions
125
Sources/MLXAudioSTS/Models/DeepFilterNet/DeepFilterNetConfig.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| import Foundation | ||
|
|
||
| /// Model configuration for DeepFilterNet, decoded from `config.json` in the model directory. | ||
| public struct DeepFilterNetConfig: Codable, Sendable { | ||
| public var sampleRate: Int = 48_000 | ||
| public var fftSize: Int = 960 | ||
| public var hopSize: Int = 480 | ||
| public var minNbErbFreqs: Int = 2 | ||
|
|
||
| public var nbErb: Int = 32 | ||
| public var nbDf: Int = 96 | ||
| public var dfOrder: Int = 5 | ||
| public var dfLookahead: Int = 2 | ||
| public var convLookahead: Int = 2 | ||
|
|
||
| public var convCh: Int = 64 | ||
| public var convKEnc: Int = 1 | ||
| public var convKDec: Int = 1 | ||
| public var convWidthFactor: Int = 1 | ||
| public var embHiddenDim: Int = 256 | ||
| public var embNumLayers: Int = 3 | ||
| public var dfHiddenDim: Int = 256 | ||
| public var dfNumLayers: Int = 2 | ||
| public var gruGroups: Int = 8 | ||
| public var linearGroups: Int = 16 | ||
| public var encLinearGroups: Int = 32 | ||
| public var groupShuffle: Bool = false | ||
| public var encConcat: Bool = false | ||
| public var dfGruSkip: String = "groupedlinear" | ||
|
|
||
| public var convKernel: [Int] = [1, 3] | ||
| public var convtKernel: [Int] = [1, 3] | ||
| public var convKernelInp: [Int] = [3, 3] | ||
| public var dfPathwayKernelSizeT: Int = 5 | ||
|
|
||
| public var lsnrMax: Int = 35 | ||
| public var lsnrMin: Int = -15 | ||
| public var modelVersion: String = "DeepFilterNet3" | ||
| public var erbWidths: [Int]? = nil | ||
|
|
||
| public var freqBins: Int { fftSize / 2 + 1 } | ||
|
|
||
| public var modelType: String { | ||
| switch modelVersion.lowercased() { | ||
| case "deepfilternet": | ||
| return "deepfilternet" | ||
| case "deepfilternet2": | ||
| return "deepfilternet2" | ||
| default: | ||
| return "deepfilternet3" | ||
| } | ||
| } | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case sampleRate | ||
| case fftSize | ||
| case hopSize | ||
| case minNbErbFreqs | ||
| case nbErb | ||
| case nbDf | ||
| case dfOrder | ||
| case dfLookahead | ||
| case convLookahead | ||
| case convCh | ||
| case convKEnc | ||
| case convKDec | ||
| case convWidthFactor | ||
| case embHiddenDim | ||
| case embNumLayers | ||
| case dfHiddenDim | ||
| case dfNumLayers | ||
| case gruGroups | ||
| case linearGroups | ||
| case encLinearGroups | ||
| case groupShuffle | ||
| case encConcat | ||
| case dfGruSkip | ||
| case convKernel | ||
| case convtKernel | ||
| case convKernelInp | ||
| case dfPathwayKernelSizeT | ||
| case lsnrMax | ||
| case lsnrMin | ||
| case modelVersion | ||
| case erbWidths | ||
| } | ||
|
|
||
| public init() {} | ||
|
|
||
| public init(from decoder: Decoder) throws { | ||
| let c = try decoder.container(keyedBy: CodingKeys.self) | ||
| sampleRate = try c.decodeIfPresent(Int.self, forKey: .sampleRate) ?? sampleRate | ||
| fftSize = try c.decodeIfPresent(Int.self, forKey: .fftSize) ?? fftSize | ||
| hopSize = try c.decodeIfPresent(Int.self, forKey: .hopSize) ?? hopSize | ||
| minNbErbFreqs = try c.decodeIfPresent(Int.self, forKey: .minNbErbFreqs) ?? minNbErbFreqs | ||
| nbErb = try c.decodeIfPresent(Int.self, forKey: .nbErb) ?? nbErb | ||
| nbDf = try c.decodeIfPresent(Int.self, forKey: .nbDf) ?? nbDf | ||
| dfOrder = try c.decodeIfPresent(Int.self, forKey: .dfOrder) ?? dfOrder | ||
| dfLookahead = try c.decodeIfPresent(Int.self, forKey: .dfLookahead) ?? dfLookahead | ||
| convLookahead = try c.decodeIfPresent(Int.self, forKey: .convLookahead) ?? convLookahead | ||
| convCh = try c.decodeIfPresent(Int.self, forKey: .convCh) ?? convCh | ||
| convKEnc = try c.decodeIfPresent(Int.self, forKey: .convKEnc) ?? convKEnc | ||
| convKDec = try c.decodeIfPresent(Int.self, forKey: .convKDec) ?? convKDec | ||
| convWidthFactor = try c.decodeIfPresent(Int.self, forKey: .convWidthFactor) ?? convWidthFactor | ||
| embHiddenDim = try c.decodeIfPresent(Int.self, forKey: .embHiddenDim) ?? embHiddenDim | ||
| embNumLayers = try c.decodeIfPresent(Int.self, forKey: .embNumLayers) ?? embNumLayers | ||
| dfHiddenDim = try c.decodeIfPresent(Int.self, forKey: .dfHiddenDim) ?? dfHiddenDim | ||
| dfNumLayers = try c.decodeIfPresent(Int.self, forKey: .dfNumLayers) ?? dfNumLayers | ||
| gruGroups = try c.decodeIfPresent(Int.self, forKey: .gruGroups) ?? gruGroups | ||
| linearGroups = try c.decodeIfPresent(Int.self, forKey: .linearGroups) ?? linearGroups | ||
| encLinearGroups = try c.decodeIfPresent(Int.self, forKey: .encLinearGroups) ?? encLinearGroups | ||
| groupShuffle = try c.decodeIfPresent(Bool.self, forKey: .groupShuffle) ?? groupShuffle | ||
| encConcat = try c.decodeIfPresent(Bool.self, forKey: .encConcat) ?? encConcat | ||
| dfGruSkip = try c.decodeIfPresent(String.self, forKey: .dfGruSkip) ?? dfGruSkip | ||
| convKernel = try c.decodeIfPresent([Int].self, forKey: .convKernel) ?? convKernel | ||
| convtKernel = try c.decodeIfPresent([Int].self, forKey: .convtKernel) ?? convtKernel | ||
| convKernelInp = try c.decodeIfPresent([Int].self, forKey: .convKernelInp) ?? convKernelInp | ||
| dfPathwayKernelSizeT = | ||
| try c.decodeIfPresent(Int.self, forKey: .dfPathwayKernelSizeT) ?? dfPathwayKernelSizeT | ||
| lsnrMax = try c.decodeIfPresent(Int.self, forKey: .lsnrMax) ?? lsnrMax | ||
| lsnrMin = try c.decodeIfPresent(Int.self, forKey: .lsnrMin) ?? lsnrMin | ||
| modelVersion = try c.decodeIfPresent(String.self, forKey: .modelVersion) ?? modelVersion | ||
| erbWidths = try c.decodeIfPresent([Int].self, forKey: .erbWidths) ?? erbWidths | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.