[bug#76999,1/2] gnu: Add python-gguf-llama-cpp.

Message ID CH3PR84MB3424609A3E0E8CE70C8AF473C5D32@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
State New
Headers
Series gnu: llama-cpp: Update to 0.0.0-b4882. |

Commit Message

Morgan Smith March 13, 2025, 9:18 p.m. UTC
  * gnu/packages/machine-learning.scm (python-gguf-llama-cpp): New variable.

Change-Id: I1c1b5f5956e3acb380b56816d180f53243b741fa
---
 gnu/packages/machine-learning.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
  

Comments

Christopher Baines April 6, 2025, 4:15 p.m. UTC | #1
Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> * gnu/packages/machine-learning.scm (python-gguf-llama-cpp): New variable.
>
> Change-Id: I1c1b5f5956e3acb380b56816d180f53243b741fa
> ---
>  gnu/packages/machine-learning.scm | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
> index 246b004156..ee5feb58fc 100644
> --- a/gnu/packages/machine-learning.scm
> +++ b/gnu/packages/machine-learning.scm
> @@ -6490,6 +6490,21 @@ (define-public python-gguf
>      (description "A Python library for reading and writing GGUF & GGML format ML models.")
>      (license license:expat)))
>  
> +(define-public python-gguf-llama-cpp
> +  (package/inherit python-gguf
> +    (version "0.16.0")
> +    (source (package-source llama-cpp))
> +    (propagated-inputs (list python-numpy python-pyyaml python-sentencepiece
> +                             python-tqdm))
> +    (native-inputs (list python-poetry-core))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments python-gguf)
> +       ((#:phases phases #~%standard-phases)
> +        #~(modify-phases #$phases
> +            (add-after 'unpack 'chdir
> +              (lambda _
> +                (chdir "gguf-py")))))))))
> +
>  (define-public python-gymnasium
>    (package
>      (name "python-gymnasium")

Can python-gguf be updated rather than adding this package?
  
Morgan Smith April 7, 2025, 11:09 p.m. UTC | #2
Christopher Baines <mail@cbaines.net> writes:

>
> Can python-gguf be updated rather than adding this package?

I had a tricky time tracking down the canonical source for the package.
I'm fairly certain now that it is actually in the llama-cpp package.  I
assumed it was a bundling situation but it doesn't seem that way.  So I
will send a patch where I simply update python-gguf.
  

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 246b004156..ee5feb58fc 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -6490,6 +6490,21 @@  (define-public python-gguf
     (description "A Python library for reading and writing GGUF & GGML format ML models.")
     (license license:expat)))
 
+(define-public python-gguf-llama-cpp
+  (package/inherit python-gguf
+    (version "0.16.0")
+    (source (package-source llama-cpp))
+    (propagated-inputs (list python-numpy python-pyyaml python-sentencepiece
+                             python-tqdm))
+    (native-inputs (list python-poetry-core))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-gguf)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'unpack 'chdir
+              (lambda _
+                (chdir "gguf-py")))))))))
+
 (define-public python-gymnasium
   (package
     (name "python-gymnasium")