Skip to content

Commit

Permalink
chore(sync): update Encodec.cpp to sync with latest ggml API (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
PABannier authored Oct 20, 2024
1 parent bc01308 commit 1af1a61
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 282 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Dependencies
Expand All @@ -48,6 +49,7 @@ jobs:
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Dependencies
Expand Down Expand Up @@ -75,6 +77,7 @@ jobs:
- name: Clone
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Setup UCRT64
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ encodec
*.th
.vscode/

build/
build/

*.wav
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(ENCODEC_STANDALONE ON)
Expand Down
10 changes: 5 additions & 5 deletions decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct encodec_decoder {
};

struct ggml_tensor *encodec_forward_decoder(
const struct encodec_decoder *decoder, struct ggml_allocr *allocr, struct ggml_context *ctx0,
const struct encodec_decoder *decoder, struct ggml_context *ctx0,
struct ggml_tensor *quantized_out, const int *ratios, const int kernel_size, const int res_kernel_size,
const int stride) {

Expand All @@ -60,14 +60,14 @@ struct ggml_tensor *encodec_forward_decoder(
const encodec_lstm lstm = decoder->lstm;

// first lstm layer
char l0_prefix[7] = "dec_l0";
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, cur, lstm.l0_ih_w, lstm.l0_hh_w, lstm.l0_ih_b, lstm.l0_hh_b, l0_prefix);

// second lstm layer
char l1_prefix[7] = "dec_l1";
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, hs1, lstm.l1_ih_w, lstm.l1_hh_w, lstm.l1_ih_b, lstm.l1_hh_b, l1_prefix);

inpL = ggml_add(ctx0, inpL, out);
}
Expand Down
Loading

0 comments on commit 1af1a61

Please sign in to comment.