-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from nikhiljangra264/main
Synching with main branch
- Loading branch information
Showing
22 changed files
with
623 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,111 @@ | ||
// Licensed under the zlib License. See full license at the bottom of this file. | ||
|
||
#ifndef THREAD_POOL_H | ||
#define THREAD_POOL_H | ||
|
||
#include <condition_variable> | ||
#include <functional> | ||
#include <future> | ||
#include <memory> | ||
#include <mutex> | ||
#include <queue> | ||
#include <stdexcept> | ||
#include <thread> | ||
#include <vector> | ||
|
||
class ThreadPool { | ||
public: | ||
ThreadPool(size_t); | ||
template <class F, class... Args> | ||
auto enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type>; | ||
~ThreadPool(); | ||
|
||
private: | ||
// need to keep track of threads so we can join them | ||
std::vector<std::thread> workers; | ||
// the task queue | ||
std::queue<std::function<void()> > tasks; | ||
|
||
// synchronization | ||
std::mutex queue_mutex; | ||
std::condition_variable condition; | ||
bool stop; | ||
}; | ||
|
||
// the constructor just launches some amount of workers | ||
inline ThreadPool::ThreadPool(size_t threads) : stop(false) { | ||
for (size_t i = 0; i < threads; ++i) | ||
workers.emplace_back([this] { | ||
for (;;) { | ||
std::function<void()> task; | ||
|
||
{ | ||
std::unique_lock<std::mutex> lock(this->queue_mutex); | ||
this->condition.wait(lock, | ||
[this] { return this->stop || !this->tasks.empty(); }); | ||
if (this->stop && this->tasks.empty()) return; | ||
task = std::move(this->tasks.front()); | ||
this->tasks.pop(); | ||
} | ||
|
||
task(); | ||
} | ||
}); | ||
} | ||
|
||
// add new work item to the pool | ||
template <class F, class... Args> | ||
auto ThreadPool::enqueue(F&& f, | ||
Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type> { | ||
using return_type = typename std::result_of<F(Args...)>::type; | ||
|
||
auto task = std::make_shared<std::packaged_task<return_type()> >( | ||
std::bind(std::forward<F>(f), std::forward<Args>(args)...)); | ||
|
||
std::future<return_type> res = task->get_future(); | ||
{ | ||
std::unique_lock<std::mutex> lock(queue_mutex); | ||
|
||
// don't allow enqueueing after stopping the pool | ||
if (stop) throw std::runtime_error("enqueue on stopped ThreadPool"); | ||
|
||
tasks.emplace([task]() { (*task)(); }); | ||
} | ||
condition.notify_one(); | ||
return res; | ||
} | ||
|
||
// the destructor joins all threads | ||
inline ThreadPool::~ThreadPool() { | ||
{ | ||
std::unique_lock<std::mutex> lock(queue_mutex); | ||
stop = true; | ||
} | ||
condition.notify_all(); | ||
for (std::thread& worker : workers) worker.join(); | ||
} | ||
|
||
#endif | ||
|
||
/* | ||
Copyright (c) 2012 Jakob Progsch, Václav Zeman | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
*/ |
Binary file not shown.
Binary file not shown.
125 changes: 125 additions & 0 deletions
125
MediaProcessor/res/DeepFilterNet3_ll_onnx/tmp/export/config.ini
This file contains 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 @@ | ||
[train] | ||
seed = 43 | ||
device = | ||
model = deepfilternet3 | ||
jit = false | ||
mask_only = false | ||
df_only = false | ||
batch_size = 64 | ||
batch_size_eval = 64 | ||
num_workers = 16 | ||
max_sample_len_s = 3.0 | ||
p_atten_lim = 0.0 | ||
overfit = false | ||
max_epochs = 120 | ||
log_freq = 100 | ||
log_timings = False | ||
validation_criteria = loss | ||
validation_criteria_rule = min | ||
early_stopping_patience = 25 | ||
global_ds_sampling_f = 1 | ||
num_prefetch_batches = 8 | ||
dataloader_snrs = -5,0,5,10,20,40 | ||
detect_anomaly = false | ||
batch_size_scheduling = 0/8,1/16,2/24,5/32,10/64,20/128,40/9999 | ||
start_eval = false | ||
validation_set_caching = false | ||
cp_blacklist = | ||
n_checkpoint_history = 10 | ||
n_best_checkpoint_history = 10 | ||
|
||
[distortion] | ||
p_reverb = 0.15 | ||
p_bandwidth_ext = 0.0 | ||
p_clipping = 0.05 | ||
p_zeroing = 0.05 | ||
p_air_absorption = 0.0 | ||
p_interfer_sp = 0.01 | ||
|
||
[df] | ||
sr = 48000 | ||
fft_size = 960 | ||
hop_size = 480 | ||
nb_erb = 32 | ||
nb_df = 96 | ||
norm_tau = 1 | ||
lsnr_max = 35 | ||
lsnr_min = -15 | ||
min_nb_erb_freqs = 2 | ||
pad_mode = output | ||
df_order = 5 | ||
df_lookahead = 0 | ||
|
||
[deepfilternet] | ||
conv_lookahead = 0 | ||
conv_ch = 64 | ||
conv_depthwise = True | ||
emb_hidden_dim = 512 | ||
emb_num_layers = 3 | ||
enc_linear_groups = 16 | ||
linear_groups = 16 | ||
conv_dec_mode = transposed | ||
convt_depthwise = True | ||
mask_pf = False | ||
df_hidden_dim = 512 | ||
df_num_layers = 3 | ||
dfop_method = df | ||
group_shuffle = False | ||
conv_kernel = 2,3 | ||
df_gru_skip = groupedlinear | ||
df_pathway_kernel_size_t = 5 | ||
enc_concat = False | ||
conv_kernel_inp = 3,3 | ||
emb_gru_skip = none | ||
df_n_iter = 1 | ||
lsnr_dropout = False | ||
|
||
[localsnrloss] | ||
factor = 1e-3 | ||
|
||
[maskloss] | ||
factor = 0.3 | ||
mask = spec | ||
gamma = 0.3 | ||
gamma_pred = 0.3 | ||
f_under = 1.0 | ||
|
||
[spectralloss] | ||
factor_magnitude = 0 | ||
factor_complex = 0 | ||
gamma = 0.3 | ||
factor_under = 1 | ||
|
||
[dfalphaloss] | ||
factor = 0.0 | ||
|
||
[multiresspecloss] | ||
factor = 700 | ||
factor_complex = 300 | ||
gamma = 0.3 | ||
fft_sizes = 1024,2048,3072 | ||
|
||
[optim] | ||
lr = 0.001 | ||
momentum = 0 | ||
weight_decay = 1e-12 | ||
weight_decay_end = 0.01 | ||
optimizer = adamw | ||
lr_min = 1e-06 | ||
lr_warmup = 0.0001 | ||
warmup_epochs = 3 | ||
lr_cycle_mul = 1.0 | ||
lr_cycle_decay = 0.5 | ||
lr_cycle_limit = 1 | ||
lr_update_per_epoch = False | ||
lr_cycle_epochs = -1 | ||
|
||
[sdrloss] | ||
factor = 0.0 | ||
segmental_ws = 0 | ||
|
||
[asrloss] | ||
factor = 0.0 | ||
factor_lm = 0.0 | ||
loss_lm = CrossEntropy | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.