diff options
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 */ |
