From cd5e1901d9940299756803622a30aad79be6fcf4 Mon Sep 17 00:00:00 2001 From: mike dupont Date: Thu, 30 Nov 2023 06:59:10 -0500 Subject: [PATCH] removed llama from common --- Makefile | 6 ++++-- binding.py | 7 +++++-- common/common.cpp | 3 ++- common/common.h | 2 +- common/grammar-parser.cpp | 1 + common/grammar-parser.h | 2 +- common/sampling.cpp | 1 + common/sampling.h | 2 +- examples/batched-bench/batched-bench.cpp | 3 ++- examples/batched/batched.cpp | 3 ++- examples/beam-search/beam-search.cpp | 3 ++- examples/benchmark/benchmark-matmult.cpp | 1 + examples/embedding/embedding.cpp | 3 ++- examples/export-lora/export-lora.cpp | 2 +- examples/infill/infill.cpp | 3 ++- examples/llava/llava-cli.cpp | 6 ++++-- examples/llava/llava.cpp | 3 ++- examples/main/main.cpp | 3 ++- examples/parallel/parallel.cpp | 4 ++-- examples/perplexity/perplexity.cpp | 3 ++- examples/quantize-stats/quantize-stats.cpp | 3 ++- examples/quantize/quantize.cpp | 3 ++- examples/save-load-state/save-load-state.cpp | 3 ++- examples/server/server.cpp | 3 ++- examples/simple/simple.cpp | 3 ++- examples/speculative/speculative.cpp | 3 ++- examples/tokenize/tokenize.cpp | 3 ++- .../train-text-from-scratch/train-text-from-scratch.cpp | 3 ++- 28 files changed, 56 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 203318320..79bdbdce3 100644 --- a/Makefile +++ b/Makefile @@ -513,7 +513,7 @@ override CFLAGS := $(MK_CPPFLAGS) $(CPPFLAGS) $(MK_CFLAGS) $(CFLAGS) override CXXFLAGS := $(MK_CPPFLAGS) $(CPPFLAGS) $(MK_CXXFLAGS) $(CXXFLAGS) override CUDA_CXXFLAGS := $(MK_CUDA_CXXFLAGS) $(CUDA_CXXFLAGS) override HOST_CXXFLAGS := $(MK_HOST_CXXFLAGS) $(HOST_CXXFLAGS) -override LDFLAGS := $(MK_LDFLAGS) $(LDFLAGS) +override LDFLAGS := $(MK_LDFLAGS) $(LDFLAGS) -ldynet # save CXXFLAGS before we add host-only options NVCCFLAGS := $(NVCCFLAGS) $(CXXFLAGS) $(CUDA_CXXFLAGS) -Wno-pedantic -Xcompiler "$(HOST_CXXFLAGS)" @@ -587,7 +587,7 @@ clean: # main: examples/main/main.cpp ggml.o llama.o $(COMMON_DEPS) console.o grammar-parser.o $(OBJS) - $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) -ldynet + $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) @echo @echo '==== Run ./main -h for help. ====' @echo @@ -740,3 +740,5 @@ tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $( tests/test-c.o: tests/test-c.cpp llama.h $(CXX) $(CXXFLAGS) -c $(filter-out %.h,$^) -o $@ +testclang: + clang -std=c++20 libdynet.cpp diff --git a/binding.py b/binding.py index dcf4c37ef..6fc5262b6 100644 --- a/binding.py +++ b/binding.py @@ -14,7 +14,8 @@ llvmLibPath = "/usr/lib/llvm-15/lib/" cxxClientRoot = "/home/mdupont/experiments/llama.cpp/" fileList = [ - "ggml.cpp", + "libdynet.cpp", +# "ggml.cpp", # "llama.cpp", # "examples/server/server.cpp", ] @@ -34,7 +35,9 @@ def list_headers_in_dir(path): # list all the files in the folder files = os.listdir(path) # only include .hxx files - files = list(filter(lambda x: x.endswith('.hxx'), files)) + files = list(filter(lambda x: + x.endswith('.hpp') or x.endswith('.h') + , files)) # add the folder path back on files = list(map(lambda x: path + x, files)) return files diff --git a/common/common.cpp b/common/common.cpp index 1dcc235ea..f5e04275c 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/common/common.h b/common/common.h index 2f6fe48ab..3d2eabd97 100644 --- a/common/common.h +++ b/common/common.h @@ -2,7 +2,7 @@ #pragma once -#include "llama.h" +//#include "llama.h" #include "sampling.h" diff --git a/common/grammar-parser.cpp b/common/grammar-parser.cpp index ff51cc803..e9c38d590 100644 --- a/common/grammar-parser.cpp +++ b/common/grammar-parser.cpp @@ -1,3 +1,4 @@ +#include "llama.h" #include "grammar-parser.h" #include #include diff --git a/common/grammar-parser.h b/common/grammar-parser.h index 9037d7272..b052b33f6 100644 --- a/common/grammar-parser.h +++ b/common/grammar-parser.h @@ -10,7 +10,7 @@ // space ::= [ \t\n]* #pragma once -#include "llama.h" +//#include "llama.h" #include #include #include diff --git a/common/sampling.cpp b/common/sampling.cpp index 1317024c2..8deb2a158 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -1,3 +1,4 @@ +#include "llama.h" #include "sampling.h" struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_params & params) { diff --git a/common/sampling.h b/common/sampling.h index 7c9b8dcf2..f8cb829bc 100644 --- a/common/sampling.h +++ b/common/sampling.h @@ -1,6 +1,6 @@ #pragma once -#include "llama.h" +//#include "llama.h" #include "grammar-parser.h" diff --git a/examples/batched-bench/batched-bench.cpp b/examples/batched-bench/batched-bench.cpp index 533c55c17..59bf20b76 100644 --- a/examples/batched-bench/batched-bench.cpp +++ b/examples/batched-bench/batched-bench.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/batched/batched.cpp b/examples/batched/batched.cpp index 22a4265df..4355bc4bf 100644 --- a/examples/batched/batched.cpp +++ b/examples/batched/batched.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/beam-search/beam-search.cpp b/examples/beam-search/beam-search.cpp index 679b382e1..27cdfd54a 100644 --- a/examples/beam-search/beam-search.cpp +++ b/examples/beam-search/beam-search.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/benchmark/benchmark-matmult.cpp b/examples/benchmark/benchmark-matmult.cpp index 284733b10..234512d19 100644 --- a/examples/benchmark/benchmark-matmult.cpp +++ b/examples/benchmark/benchmark-matmult.cpp @@ -1,3 +1,4 @@ +#include "llama.h" #include "common.h" #include "ggml.h" diff --git a/examples/embedding/embedding.cpp b/examples/embedding/embedding.cpp index 3295cd240..6dda23524 100644 --- a/examples/embedding/embedding.cpp +++ b/examples/embedding/embedding.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include diff --git a/examples/export-lora/export-lora.cpp b/examples/export-lora/export-lora.cpp index c8754ce70..f78791e13 100644 --- a/examples/export-lora/export-lora.cpp +++ b/examples/export-lora/export-lora.cpp @@ -1,4 +1,4 @@ - +#include "llama.h" #include "common.h" #include "ggml.h" #include "ggml-alloc.h" diff --git a/examples/infill/infill.cpp b/examples/infill/infill.cpp index 4a7827876..379219791 100644 --- a/examples/infill/infill.cpp +++ b/examples/infill/infill.cpp @@ -1,7 +1,8 @@ +#include "llama.h" #include "common.h" #include "console.h" -#include "llama.h" + #include "grammar-parser.h" #include diff --git a/examples/llava/llava-cli.cpp b/examples/llava/llava-cli.cpp index 31f8cd8e0..41a75177b 100644 --- a/examples/llava/llava-cli.cpp +++ b/examples/llava/llava-cli.cpp @@ -1,8 +1,10 @@ #include "ggml.h" +#include "llama.h" +#include "llava.h" #include "common.h" #include "clip.h" -#include "llava.h" -#include "llama.h" + + #include "base64.hpp" diff --git a/examples/llava/llava.cpp b/examples/llava/llava.cpp index 0cae8c4b1..9c7989f7f 100644 --- a/examples/llava/llava.cpp +++ b/examples/llava/llava.cpp @@ -1,6 +1,7 @@ #include "clip.h" -#include "common.h" #include "llama.h" +#include "common.h" + #include "llava.h" #include diff --git a/examples/main/main.cpp b/examples/main/main.cpp index d3c6cb4f5..be4e5c1af 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -1,7 +1,8 @@ +#include "llama.h" #include "common.h" #include "console.h" -#include "llama.h" + #include #include diff --git a/examples/parallel/parallel.cpp b/examples/parallel/parallel.cpp index d2e074d9e..13ba400eb 100644 --- a/examples/parallel/parallel.cpp +++ b/examples/parallel/parallel.cpp @@ -1,8 +1,8 @@ // A basic application simulating a server with multiple clients. // The clients submit requests to the server and they are processed in parallel. - -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/perplexity/perplexity.cpp b/examples/perplexity/perplexity.cpp index 9a77beca6..8f8c0454b 100644 --- a/examples/perplexity/perplexity.cpp +++ b/examples/perplexity/perplexity.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/quantize-stats/quantize-stats.cpp b/examples/quantize-stats/quantize-stats.cpp index 271282477..2a603deab 100644 --- a/examples/quantize-stats/quantize-stats.cpp +++ b/examples/quantize-stats/quantize-stats.cpp @@ -1,7 +1,8 @@ #define LLAMA_API_INTERNAL +#include "llama.h" #include "common.h" #include "ggml.h" -#include "llama.h" + #include #include diff --git a/examples/quantize/quantize.cpp b/examples/quantize/quantize.cpp index d27ea5e91..0846a4f8a 100644 --- a/examples/quantize/quantize.cpp +++ b/examples/quantize/quantize.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/save-load-state/save-load-state.cpp b/examples/save-load-state/save-load-state.cpp index 48d801110..d2b4d5e67 100644 --- a/examples/save-load-state/save-load-state.cpp +++ b/examples/save-load-state/save-load-state.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/server/server.cpp b/examples/server/server.cpp index b202bafe0..ba82c6491 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include "grammar-parser.h" #include "../llava/clip.h" diff --git a/examples/simple/simple.cpp b/examples/simple/simple.cpp index 374aef6f1..1aacd8151 100644 --- a/examples/simple/simple.cpp +++ b/examples/simple/simple.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/speculative/speculative.cpp b/examples/speculative/speculative.cpp index ace755c51..bc4e6f859 100644 --- a/examples/speculative/speculative.cpp +++ b/examples/speculative/speculative.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/tokenize/tokenize.cpp b/examples/tokenize/tokenize.cpp index 4ff8e3fa7..e205eac0d 100644 --- a/examples/tokenize/tokenize.cpp +++ b/examples/tokenize/tokenize.cpp @@ -1,5 +1,6 @@ -#include "common.h" #include "llama.h" +#include "common.h" + #include #include diff --git a/examples/train-text-from-scratch/train-text-from-scratch.cpp b/examples/train-text-from-scratch/train-text-from-scratch.cpp index f049a3923..d0f8e5e48 100644 --- a/examples/train-text-from-scratch/train-text-from-scratch.cpp +++ b/examples/train-text-from-scratch/train-text-from-scratch.cpp @@ -1,8 +1,9 @@ #include "ggml.h" #include "ggml-alloc.h" +#include "llama.h" #include "common.h" #include "train.h" -#include "llama.h" + #include #include #include