clang-format
This commit is contained in:
@@ -95,8 +95,10 @@ std::vector<float> pipeline_codec_decode(PipelineCodec * pc, const int32_t * cod
|
||||
// codec-pre-fsq.bin under that directory. Quiet otherwise.
|
||||
// Returns codes flat as [K, T] row-major, K = QWEN_TOKENIZER_NUM_CODEBOOKS,
|
||||
// T = n_samples / 1920. Empty on failure.
|
||||
std::vector<int32_t> pipeline_codec_encode(PipelineCodec * pc, const float * audio, int n_samples,
|
||||
const char * dump_dir = NULL);
|
||||
std::vector<int32_t> pipeline_codec_encode(PipelineCodec * pc,
|
||||
const float * audio,
|
||||
int n_samples,
|
||||
const char * dump_dir = NULL);
|
||||
|
||||
// Free every backend buffer and ggml context. Safe to call on a zeroed struct.
|
||||
void pipeline_codec_free(PipelineCodec * pc);
|
||||
|
||||
@@ -214,8 +214,8 @@ static struct ggml_tensor * qwen_seanet_encoder_forward(struct ggml_context *
|
||||
if (i == 0 && resnet0_out) {
|
||||
*resnet0_out = x;
|
||||
}
|
||||
x = ggml_elu(ctx, x);
|
||||
x = qwen_causal_conv1d(ctx, stg.down_w, stg.down_b, x, 2 * stg.ratio, 1, stg.ratio);
|
||||
x = ggml_elu(ctx, x);
|
||||
x = qwen_causal_conv1d(ctx, stg.down_w, stg.down_b, x, 2 * stg.ratio, 1, stg.ratio);
|
||||
if (i == 0 && stage0_out) {
|
||||
*stage0_out = x;
|
||||
}
|
||||
|
||||
@@ -118,21 +118,20 @@ static bool speaker_encoder_extract(const SpeakerEncoderWeights * sw,
|
||||
ggml_set_input(dft_im_in);
|
||||
ggml_set_input(mel_b_in);
|
||||
|
||||
struct ggml_tensor * mel_t = NULL;
|
||||
struct ggml_tensor * mel_dump = NULL;
|
||||
struct ggml_tensor * mag_t = NULL;
|
||||
struct ggml_tensor * mag_dump = NULL;
|
||||
struct ggml_tensor * front_t = NULL;
|
||||
struct ggml_tensor * front_dump = NULL;
|
||||
struct ggml_tensor * blk3_t = NULL;
|
||||
struct ggml_tensor * blk3_dump = NULL;
|
||||
struct ggml_tensor * mfa_t = NULL;
|
||||
struct ggml_tensor * mfa_dump = NULL;
|
||||
struct ggml_tensor * asp_t = NULL;
|
||||
struct ggml_tensor * asp_dump = NULL;
|
||||
struct ggml_tensor * emb =
|
||||
speaker_encoder_forward(gctx, sw, audio_in, hann_in, dft_re_in, dft_im_in, mel_b_in, mel_cfg,
|
||||
&mel_t, &mag_t, &front_t, &blk3_t, &mfa_t, &asp_t);
|
||||
struct ggml_tensor * mel_t = NULL;
|
||||
struct ggml_tensor * mel_dump = NULL;
|
||||
struct ggml_tensor * mag_t = NULL;
|
||||
struct ggml_tensor * mag_dump = NULL;
|
||||
struct ggml_tensor * front_t = NULL;
|
||||
struct ggml_tensor * front_dump = NULL;
|
||||
struct ggml_tensor * blk3_t = NULL;
|
||||
struct ggml_tensor * blk3_dump = NULL;
|
||||
struct ggml_tensor * mfa_t = NULL;
|
||||
struct ggml_tensor * mfa_dump = NULL;
|
||||
struct ggml_tensor * asp_t = NULL;
|
||||
struct ggml_tensor * asp_dump = NULL;
|
||||
struct ggml_tensor * emb = speaker_encoder_forward(gctx, sw, audio_in, hann_in, dft_re_in, dft_im_in, mel_b_in,
|
||||
mel_cfg, &mel_t, &mag_t, &front_t, &blk3_t, &mfa_t, &asp_t);
|
||||
ggml_set_output(emb);
|
||||
if (dump_dir && mel_t) {
|
||||
// mel_t has ggml ne=(n_mels, T_frames), which streams row-major
|
||||
|
||||
@@ -57,9 +57,9 @@ static struct ggml_tensor * spk_conv1d_same(struct ggml_context * ctx,
|
||||
// axis is ne[1], so we transpose to bring T to ne[0], pad, and keep
|
||||
// it that way : the im2col downstream expects ne[0]=T_pad, ne[1]=IC,
|
||||
// which is exactly the layout we end up with here.
|
||||
struct ggml_tensor * x_t = ggml_cont(ctx, ggml_transpose(ctx, x)); // ne=(T, IC)
|
||||
struct ggml_tensor * x_t = ggml_cont(ctx, ggml_transpose(ctx, x)); // ne=(T, IC)
|
||||
if (pad > 0) {
|
||||
x_t = ggml_pad_reflect_1d(ctx, x_t, pad, pad); // ne=(T+2*pad, IC)
|
||||
x_t = ggml_pad_reflect_1d(ctx, x_t, pad, pad); // ne=(T+2*pad, IC)
|
||||
}
|
||||
|
||||
// Reshape to 4D for ggml_im2col 1D : ne=(T_pad, IC, 1, 1).
|
||||
@@ -301,7 +301,8 @@ static struct ggml_tensor * speaker_encoder_forward(struct ggml_context *
|
||||
struct ggml_tensor ** mfa_out = NULL,
|
||||
struct ggml_tensor ** asp_out = NULL) {
|
||||
// Mel : [n_mels=128, T_frames]
|
||||
struct ggml_tensor * mel = audio_mel_build_graph(ctx, audio_padded, hann, dft_real, dft_imag, mel_basis, mel_cfg, mag_out);
|
||||
struct ggml_tensor * mel =
|
||||
audio_mel_build_graph(ctx, audio_padded, hann, dft_real, dft_imag, mel_basis, mel_cfg, mag_out);
|
||||
if (mel_out) {
|
||||
*mel_out = mel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user