Download src/ga_decoder.h from eschmidbauer/GigaAM-v4-c: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/eschmidbauer/GigaAM-v4-c/resolve/main/src/ga_decoder.h
- Command line
-
hf download hf://eschmidbauer/GigaAM-v4-c/src/ga_decoder.h
-
curl -L -o ga_decoder.h https://huggingface.co/eschmidbauer/GigaAM-v4-c/resolve/main/src/ga_decoder.h
1.36 kB
| /* RNN-T greedy decoding and piece-to-text assembly for one head. */ | |
| typedef struct ga_head { | |
| const char *name; | |
| int vocab; /* classes including blank */ | |
| int blank; | |
| int hidden; /* prediction network width */ | |
| int joint; | |
| int enc; | |
| int max_symbols; | |
| const float *embed; | |
| const float *lstm_w, *lstm_r, *lstm_b; /* ONNX gate order i, o, f, c */ | |
| const float *enc_w, *enc_b, *pred_w, *pred_b, *out_w, *out_b; | |
| const char **pieces; | |
| int n_pieces; | |
| } ga_head; | |
| typedef struct ga_head_state { | |
| int last; /* last emitted token, blank before the first */ | |
| int have_pred; | |
| float *h, *c, *h_next, *c_next; | |
| float *pred, *gates, *joint, *logits; | |
| float *enc; /* [max_frames, joint] */ | |
| char *text; | |
| size_t text_len, text_cap, text_taken; | |
| int *tokens; | |
| size_t n_tokens, cap_tokens; | |
| } ga_head_state; | |
| int ga_head_init(ga_head *h, ga_weights *w, const char *name, int index, int enc_dim); | |
| int ga_head_state_init(const ga_head *h, ga_head_state *s, int max_frames); | |
| void ga_head_state_reset(const ga_head *h, ga_head_state *s); | |
| void ga_head_state_free(ga_head_state *s); | |
| /* Decode encoded[frames, enc]; returns 0 or -1 on allocation failure. */ | |
| int ga_head_decode(const ga_head *h, ga_head_state *s, const float *encoded, int frames); | |