diff --git a/llm/llama.cpp/Portfile b/llm/llama.cpp/Portfile index 6707b31268b54..3bcbde70471fc 100644 --- a/llm/llama.cpp/Portfile +++ b/llm/llama.cpp/Portfile @@ -5,9 +5,9 @@ PortGroup github 1.0 PortGroup cmake 1.1 PortGroup legacysupport 1.1 -github.setup ggerganov llama.cpp 4534 b +github.setup ggerganov llama.cpp 4574 b github.tarball_from archive -set git-commit 955a6c2 +set git-commit 7fee288 # This line is for displaying commit in CLI only revision 0 categories llm @@ -19,9 +19,9 @@ long_description The main goal of ${name} is to enable LLM inference with setup and state-of-the-art performance on a wide variety of hardware\ - locally and in the cloud. -checksums rmd160 771fa15d2c7b6a3ef9114fd3c0afb676e0ba6559 \ - sha256 f4b57daa8d6bfe957f08a79f02ea9d24018ce9e73663c35a5c21f31ed3ccfcb8 \ - size 20496342 +checksums rmd160 047ed3d0c1252e83dd78ade21175899e2c7c4b05 \ + sha256 ce168eccb03da802c39486ab6b18dd225027d5c34cfbc5f46fec1870a1bdd624 \ + size 20504479 # error: 'filesystem' file not found on 10.14 legacysupport.newest_darwin_requires_legacy \ @@ -41,8 +41,7 @@ post-patch { compiler.cxx_standard 2017 -configure.args-append -LAH \ - -DGGML_LTO=ON \ +configure.args-append -DGGML_LTO=ON \ -DGGML_CCACHE=OFF \ -DGGML_OPENMP=OFF \ -DLLAMA_CURL=ON @@ -60,6 +59,10 @@ if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx" && \ -DGGML_METAL_EMBED_LIBRARY=OFF } +post-destroot { + delete {*}[glob -directory ${destroot}${prefix}/bin/ convert*.py] +} + variant blas description {Uses BLAS, improves performance} { configure.args-append \ -DGGML_BLAS=ON @@ -90,6 +93,32 @@ variant openmp description {enable parallelism support using OpenMP} { } } +variant model_converters description {install extra model conversion Python scripts} { + set ::python_branch 3.12 + set ::python_version [string map {. ""} ${::python_branch}] + depends_run-append port:python${::python_version} \ + port:py${::python_version}-numpy \ + port:py${::python_version}-pytorch \ + port:py${::python_version}-transformers \ + port:py${::python_version}-gguf + + post-patch { + reinplace "s|#!/usr/bin/env python3|#!${prefix}/bin/python${::python_branch}|" {*}[glob ${worksrcpath}/convert*.py] + } + + post-destroot { + xinstall -d ${destroot}${prefix}/libexec/${name} + xinstall -m 755 {*}[glob ${worksrcpath}/convert*.py] ${destroot}${prefix}/libexec/${name} + foreach file [glob -directory ${destroot}${prefix}/libexec/${name} *.py] { + set filebasename [file rootname [file tail $file]] + set link ${destroot}${prefix}/bin/[lindex [split ${name} .] 0]-[string map {_ -} ${filebasename}] + set target [string replace ${file} 0 [string length ${destroot}]-1] + ui_debug "Creating symlink: ${link} => ${target}" + ln -s ${target} ${link} + } + } +} + variant native description "Force local build and optimize for CPU" { configure.args-append \ -DGGML_NATIVE=ON