Skip to content

Commit

Permalink
fix: debug decoder (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
PABannier committed Oct 22, 2023
1 parent 133051d commit f00ad69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions encodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,13 @@ struct ggml_tensor * encodec_forward_encoder(

// first lstm layer
struct ggml_tensor * hs1 = forward_pass_lstm_unilayer(
ctx0, allocr, cur, lstm.l0_ih_w, lstm.l0_hh_w, lstm.l0_ih_b, lstm.l0_hh_b);
ctx0, allocr, cur, lstm.l0_ih_w, lstm.l0_hh_w,
lstm.l0_ih_b, lstm.l0_hh_b);

// second lstm layer
struct ggml_tensor * out = forward_pass_lstm_unilayer(
ctx0, allocr, hs1, lstm.l1_ih_w, lstm.l1_hh_w, lstm.l1_ih_b, lstm.l1_hh_b);
ctx0, allocr, hs1, lstm.l1_ih_w, lstm.l1_hh_w,
lstm.l1_ih_b, lstm.l1_hh_b);

inpL = ggml_add(ctx0, inpL, out);
}
Expand Down
3 changes: 3 additions & 0 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ int main(int argc, char **argv) {
return 1;
}

encodec_set_target_bandwidth(ectx, 12);

// read audio from disk
std::vector<float> original_audio_arr;
if(!read_wav_from_disk(params.input_path, original_audio_arr)) {
Expand All @@ -40,6 +42,7 @@ int main(int argc, char **argv) {

// write reconstructed audio on disk
auto & audio_arr = ectx->out_audio;
audio_arr.resize(original_audio_arr.size()); // output is slightly longer than input
write_wav_on_disk(audio_arr, params.output_path);

// report timing
Expand Down
2 changes: 1 addition & 1 deletion ggml
Submodule ggml updated 1 files
+33 −25 src/ggml.c

0 comments on commit f00ad69

Please sign in to comment.