Skip to content
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

Allow all zero rows in mel computation matrix. #107

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(kaldifeat)
# remember to change the version in
# scripts/conda/kaldifeat/meta.yaml
# scripts/conda-cpu/kaldifeat/meta.yaml
set(kaldifeat_VERSION "1.25.4")
set(kaldifeat_VERSION "1.25.5")

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
Expand Down
10 changes: 6 additions & 4 deletions kaldifeat/csrc/mel-computations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ MelBanks::MelBanks(const MelBanksOptions &opts,
<< " and vtln-high " << vtln_high << ", versus "
<< "low-freq " << low_freq << " and high-freq " << high_freq;

// we will transpose bins_mat_ at the end of this funciton
// we will transpose bins_mat_ at the end of this function
bins_mat_ = torch::zeros({num_bins, num_fft_bins}, torch::kFloat);

int32_t stride = bins_mat_.strides()[0];
Expand Down Expand Up @@ -179,12 +179,14 @@ MelBanks::MelBanks(const MelBanksOptions &opts,
last_index = i;
}
}
KALDIFEAT_ASSERT(first_index != -1 && last_index >= first_index &&
"You may have set num_mel_bins too large.");

// Note: It is possible that first_index == last_index == -1 at this line.

// Replicate a bug in HTK, for testing purposes.
if (opts.htk_mode && bin == 0 && mel_low_freq != 0.0f)
if (opts.htk_mode && bin == 0 && mel_low_freq != 0.0f &&
first_index != -1) {
this_bin[first_index] = 0.0f;
}
}

if (debug_) KALDIFEAT_LOG << bins_mat_;
Expand Down
2 changes: 1 addition & 1 deletion scripts/conda-cpu/kaldifeat/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: kaldifeat
version: "1.25.4"
version: "1.25.5"

source:
path: "{{ environ.get('KALDIFEAT_ROOT_DIR') }}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/conda/kaldifeat/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: kaldifeat
version: "1.25.4"
version: "1.25.5"

source:
path: "{{ environ.get('KALDIFEAT_ROOT_DIR') }}"
Expand Down
Loading