passepartout: v0.5.1 — Compilation Hardening
Fixed 3 real compilation errors: - security-vault.lisp: bare defvar missing opening paren - embedding-native.lisp: CFFI struct refs updated (llama-mparams→(:struct ...), 19 places) - symbolic-events.lisp: heartbeat vars + save-memory-to-disk → passepartout:: prefix Suppressed ~100 harmless cross-skill STYLE-WARNINGs: - Added grep filter for STYLE-WARNING / WARNING: redefining in the pre-compile step of the passepartout bash script ROADMAP updated: all v0.5.1 items marked DONE. Test suite: 116/116 (100%)
This commit is contained in:
@@ -95,22 +95,22 @@
|
||||
(sb-int:set-floating-point-modes :traps '())
|
||||
(bl)
|
||||
;; Load model
|
||||
(cffi:with-foreign-object (mp 'llama-mparams)
|
||||
(cffi:with-foreign-object (mp '(:struct llama-mparams))
|
||||
(mdp mp)
|
||||
(setf (cffi:foreign-slot-value mp 'llama-mparams 'n-gpu-layers) 0)
|
||||
(setf (cffi:foreign-slot-value mp 'llama-mparams 'use-mmap) 0)
|
||||
(setf (cffi:foreign-slot-value mp '(:struct llama-mparams) 'n-gpu-layers) 0)
|
||||
(setf (cffi:foreign-slot-value mp '(:struct llama-mparams) 'use-mmap) 0)
|
||||
(setf *native-model* (wrap-load (namestring *native-model-path*) mp)))
|
||||
(setf *native-vocab* (gv *native-model*))
|
||||
;; Create context
|
||||
(let ((n-embd (ne *native-model*)))
|
||||
(cffi:with-foreign-object (cp 'llama-cparams)
|
||||
(cffi:with-foreign-object (cp '(:struct llama-cparams))
|
||||
(cdp cp)
|
||||
(setf (cffi:foreign-slot-value cp 'llama-cparams 'n-ctx) 512)
|
||||
(setf (cffi:foreign-slot-value cp 'llama-cparams 'n-batch) 512)
|
||||
(setf (cffi:foreign-slot-value cp 'llama-cparams 'n-ubatch) 512)
|
||||
(setf (cffi:foreign-slot-value cp 'llama-cparams 'n-seq-max) 1)
|
||||
(setf (cffi:foreign-slot-value cp 'llama-cparams 'n-threads) 2)
|
||||
(setf (cffi:foreign-slot-value cp 'llama-cparams 'embeddings) 1)
|
||||
(setf (cffi:foreign-slot-value cp '(:struct llama-cparams) 'n-ctx) 512)
|
||||
(setf (cffi:foreign-slot-value cp '(:struct llama-cparams) 'n-batch) 512)
|
||||
(setf (cffi:foreign-slot-value cp '(:struct llama-cparams) 'n-ubatch) 512)
|
||||
(setf (cffi:foreign-slot-value cp '(:struct llama-cparams) 'n-seq-max) 1)
|
||||
(setf (cffi:foreign-slot-value cp '(:struct llama-cparams) 'n-threads) 2)
|
||||
(setf (cffi:foreign-slot-value cp '(:struct llama-cparams) 'embeddings) 1)
|
||||
(setf *native-context* (wrap-ctx *native-model* cp)))
|
||||
(format *error-output* "~&;; EMBEDDING: Native model loaded (~d-dim)~%" n-embd)))
|
||||
(values *native-model* *native-context* *native-vocab*))
|
||||
@@ -129,16 +129,16 @@ Returns a simple-vector of single-floats (dimension: n_embd, typically 768)."
|
||||
(when (zerop n-tok)
|
||||
(error "Native embedding: tokenization returned 0 tokens for ~s" text))
|
||||
(let ((result (make-array n-embd :element-type 'single-float :initial-element 0.0f0)))
|
||||
(cffi:with-foreign-object (batch 'llama-batch)
|
||||
(cffi:with-foreign-object (batch '(:struct llama-batch))
|
||||
(wrap-batch-init batch n-tok 0 1)
|
||||
(setf (cffi:foreign-slot-value batch 'llama-batch 'n-tokens) n-tok)
|
||||
(setf (cffi:foreign-slot-value batch '(:struct llama-batch) 'n-tokens) n-tok)
|
||||
(dotimes (i n-tok)
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch 'llama-batch 'token) :int32 i)
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch '(:struct llama-batch) 'token) :int32 i)
|
||||
(cffi:mem-aref tokens :int32 i))
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch 'llama-batch 'pos) :int32 i) i)
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch 'llama-batch 'n-seq-id) :int32 i) 1)
|
||||
(setf (cffi:mem-aref (cffi:mem-aref (cffi:foreign-slot-value batch 'llama-batch 'seq-id) :pointer i) :int32 0) 0)
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch 'llama-batch 'logits) :int8 i) 1))
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch '(:struct llama-batch) 'pos) :int32 i) i)
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch '(:struct llama-batch) 'n-seq-id) :int32 i) 1)
|
||||
(setf (cffi:mem-aref (cffi:mem-aref (cffi:foreign-slot-value batch '(:struct llama-batch) 'seq-id) :pointer i) :int32 0) 0)
|
||||
(setf (cffi:mem-aref (cffi:foreign-slot-value batch '(:struct llama-batch) 'logits) :int8 i) 1))
|
||||
(let ((enc (wrap-encode *native-context* batch)))
|
||||
(unless (zerop enc)
|
||||
(error "Native embedding: encode returned ~d" enc)))
|
||||
|
||||
Reference in New Issue
Block a user