Ver código fonte

fix sync script

jmorganca 11 meses atrás
pai
commit
4a5633e4bc
5 arquivos alterados com 15 adições e 10 exclusões
  1. BIN
      ggml-metal.o
  2. 2 2
      llama/README.md
  3. 0 0
      llama/build_cuda.sh
  4. 0 0
      llama/build_hipblas.sh
  5. 13 8
      scripts/sync_llama.sh

BIN
ggml-metal.o


+ 2 - 2
llama/README.md

@@ -47,7 +47,7 @@ Install the [CUDA toolkit v11.3.1](https://developer.nvidia.com/cuda-11-3-1-down
 Build `ggml-cuda.dll`:
 
 ```shell
-./cuda.sh
+./build_cuda.sh
 ```
 
 Then build the package with the `cuda` tag:
@@ -63,7 +63,7 @@ Install [ROCm 5.7.1](https://rocm.docs.amd.com/en/docs-5.7.1/) and [Strawberry P
 Then, build `ggml-hipblas.dll`:
 
 ```shell
-./hipblas.sh
+./build_hipblas.sh
 ```
 
 Then build the package with the `rocm` tag:

+ 0 - 0
llama/cuda.sh → llama/build_cuda.sh


+ 0 - 0
llama/hipblas.sh → llama/build_hipblas.sh


+ 13 - 8
llama/sync.sh → scripts/sync_llama.sh

@@ -3,8 +3,13 @@
 # Set the source directory
 src_dir=$1
 
+if [ -z "$src_dir" ]; then
+  echo "Usage: $0 LLAMA_CPP_DIR"
+  exit 1
+fi
+
 # Set the destination directory (current directory)
-dst_dir="."
+dst_dir=./llama
 
 # llama.cpp
 cp $src_dir/unicode.cpp $dst_dir/unicode.cpp
@@ -40,20 +45,20 @@ cp $src_dir/ggml-cuda/*.cu $dst_dir/ggml-cuda/
 cp $src_dir/ggml-cuda/*.cuh $dst_dir/ggml-cuda/
 
 # apply patches
-for patch in patches/*.patch; do
+for patch in $dst_dir/patches/*.patch; do
   git apply "$patch"
 done
 
 # add license
 sha1=$(git -C $src_dir rev-parse @)
 
-tempdir=$(mktemp)
+TEMP_LICENSE=$(mktemp)
 cleanup() {
-    rm -f $tempdir
+    rm -f $TEMP_LICENSE
 }
 trap cleanup 0
 
-cat <<EOF | sed 's/ *$//' >$tempdir
+cat <<EOF | sed 's/ *$//' >$TEMP_LICENSE
 /**
  * llama.cpp - git $sha1
  *
@@ -67,13 +72,13 @@ for IN in $dst_dir/*.{c,h,cpp,m,metal,cu}; do
         continue
     fi
     TMP=$(mktemp)
-    cat $tempdir $IN >$TMP
+    cat $TEMP_LICENSE $IN >$TMP
     mv $TMP $IN
 done
 
 # ggml-metal
-sed -i '' '1s;^;//go:build darwin,arm64\n\n;' ggml-metal.m
-sed -e '/#include "ggml-common.h"/r ggml-common.h' -e '/#include "ggml-common.h"/d' < ggml-metal.metal > temp.metal
+sed -i '' '1s;^;// go:build darwin,arm64\n\n;' $dst_dir/ggml-metal.m
+sed -e '/#include "ggml-common.h"/r ggml-common.h' -e '/#include "ggml-common.h"/d' < $dst_dir/ggml-metal.metal > temp.metal
 TEMP_ASSEMBLY=$(mktemp)
 echo ".section __DATA, __ggml_metallib"   >  $TEMP_ASSEMBLY
 echo ".globl _ggml_metallib_start"        >> $TEMP_ASSEMBLY