diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-09-29 13:11:00 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-09-29 13:11:00 +0200 |
| commit | 37cbaef9ceb828c667da8f398027ba5415ee7475 (patch) | |
| tree | 6103e92a9030766e78a35df00f7a1155d0d0ecf5 /liblangdet/model_types.h | |
| parent | cf7d8169ec12cb3adf90d4ff78b3257e74985302 (diff) | |
| download | langdet-37cbaef9ceb828c667da8f398027ba5415ee7475.tar.gz langdet-37cbaef9ceb828c667da8f398027ba5415ee7475.zip | |
Rename CPU library API and sources to langdet
Diffstat (limited to 'liblangdet/model_types.h')
| -rw-r--r-- | liblangdet/model_types.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/liblangdet/model_types.h b/liblangdet/model_types.h new file mode 100644 index 0000000..2170909 --- /dev/null +++ b/liblangdet/model_types.h @@ -0,0 +1,56 @@ +#ifndef LANGDET_MODEL_TYPES_H +#define LANGDET_MODEL_TYPES_H + +#include "langdet.h" +#include "safetensors.h" + +typedef struct { + const float *wq; + const float *wk; + const float *wv; + const float *wo; + const float *q_bias; + const float *k_bias; + const float *v_bias; + const float *o_bias; + const float *input_norm; + const float *attn_ln_bias; + const float *up_proj; + const float *ffn_inter_bias; + const float *down_proj; + const float *ffn_out_bias; + const float *post_attn_norm; + const float *ffn_ln_bias; +} langdet_layer_t; + +typedef struct { + const float *embed_tokens; + langdet_layer_t *layers; + const float *position_embeddings; + const float *token_type_embeddings; + const float *langdet_ln_w; + const float *langdet_ln_b; +} langdet_weights_t; + +struct langdet_model { + langdet_config_t config; + langdet_weights_t weights; + /* All weight pointers borrow this mapping until model teardown. */ + multi_safetensors_t *safetensors; +}; + +struct langdet_workspace { + const langdet_model_t *model; + int buf_seq_cap; + float *x; + float *q; + float *k; + float *v; + float *attn_out; + float *proj_out; + float *ffn_up; + float *attn_scores; + size_t attn_scores_bytes; +}; + +#endif /* LANGDET_MODEL_TYPES_H */ |
