aboutsummaryrefslogtreecommitdiff
path: root/src/model_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/model_internal.h')
-rw-r--r--src/model_internal.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/model_internal.h b/src/model_internal.h
index f61b069..acbba07 100644
--- a/src/model_internal.h
+++ b/src/model_internal.h
@@ -12,7 +12,8 @@
* file. The frontends and the GPU backends do not include this header. */
/* Validate that a safetensor matches an expected dtype/rank/shape and that its
- * bytes lie within the mapped file. bf16_ok permits BF16 in addition to F32. */
+ * bytes lie within the mapped file. bf16_ok permits either 16-bit float format
+ * (BF16 or F16) in addition to F32. */
int tensor_has_supported_shape(const safetensors_file_t *sf,
const safetensor_t *t,
const char *name,
@@ -20,6 +21,12 @@ int tensor_has_supported_shape(const safetensors_file_t *sf,
int ndim,
int bf16_ok);
+/* Build a weight ref from a located tensor: F32/BF16 borrow the mmap, F16 is
+ * widened to an owned F32 buffer (no fused F16 kernel). Shared by the model
+ * loader and the late-interaction projection loader; the owner frees ref.data
+ * when ref.owned is set. Returns ref.data == NULL on allocation failure. */
+embed_weight_ref_t weight_ref_from_tensor(const safetensors_file_t *sf, const safetensor_t *t);
+
/* True if model_dir carries a 1_Dense projection (a late-interaction model). */
int model_dir_has_late_projection(const char *model_dir);