summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile15
-rw-r--r--README.txt46
-rwxr-xr-xtest_prompts.sh2
4 files changed, 20 insertions, 44 deletions
diff --git a/.gitignore b/.gitignore
index 2e89d8d..9c37020 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.o
*.gguf
lex
+lexd
deps/
**/*.swp
diff --git a/Makefile b/Makefile
index c6f9cb4..4dec12f 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,12 @@ CFLAGS = -march=native -O2 -std=c11 -Wall -Wextra
CXXFLAGS = -march=native -O2 -O2 -Wall -Wextra
INCLUDES = -I. -Ideps/include
+# Standard tools and target directory
+BINDIR = /usr/local/bin
+INSTALL = install
+INSTALL_PROGRAM = $(INSTALL) -m 755
+MKDIR_P = mkdir -p
+
LLAMA_TAG = b10107
LLAMA_URL = https://github.com/ggml-org/llama.cpp/archive/refs/tags/$(LLAMA_TAG).tar.gz
LLAMA_TAR = deps/llama-$(LLAMA_TAG).tar.gz
@@ -17,7 +23,7 @@ STATIC_LIBS = deps/lib/libllama.a \
# System flags required for static linking llama on OpenBSD
SYS_LIBS = -static -pthread -lm -lc++ -lc++abi
-TARGET = lex
+TARGET = lexd
SRC = llm.c main.c
OBJS = $(SRC:.c=.o)
@@ -79,6 +85,13 @@ deps/lib/libllama.a deps/lib/libggml.a deps/lib/libggml-cpu.a:
@echo "===> Cleaning up build directory..."
rm -rf $(LLAMA_SRC_DIR)
+install: $(TARGET)
+ $(MKDIR_P) $(DESTDIR)$(BINDIR)
+ $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
+
+uninstall:
+ rm -f $(DESTDIR)$(BINDIR)/$(TARGET)
+
clean:
rm -f $(TARGET) $(OBJS)
diff --git a/README.txt b/README.txt
index d01e545..912ef47 100644
--- a/README.txt
+++ b/README.txt
@@ -1,43 +1,5 @@
-RUN:
+USAGE
-Run with no logs: GGML_LOG_LEVEL=0 ./lex
-Run with error logs: GGML_LOG_LEVEL=error ./lex
-
-TEST
-
-# slowcgi -d -v -s /var/www/run/slowcgi_debug.sock
-
-Without PGP:
-
-# echo -n "body-mime=hello%20world" | chroot -u www /var/www /usr/bin/perl -e '
- $ENV{CONTENT_TYPE} = "application/x-www-form-urlencoded";
- $ENV{CONTENT_LENGTH} = 23;
- $ENV{REMOTE_ADDR} = "127.0.0.1";
- $ENV{HTTP_USER_AGENT}= "test-cli";
- do "/cgi-bin/lex.cgi";
- print $@ if $@;
-'
-
-CHROOT:
-
-# Create the jail root
-mkdir -p /var/empty/dict_jail/dev
-
-# Copy or move your model file into the jail
-cp Qwen2.5-7B-Instruct-Q4_K_M.gguf /var/empty/dict_jail/
-
-# Create necessary device nodes inside the jail
-mknod -m 666 /var/empty/dict_jail/dev/null c 2 2
-mknod -m 666 /var/empty/dict_jail/dev/zero c 2 12
-
-# Fix permissions so 'nobody' can read the model file
-chown -R root:wheel /var/empty/dict_jail
-chmod 755 /var/empty/dict_jail
-chmod 644 /var/empty/dict_jail/Qwen2.5-7B-Instruct-Q4_K_M.gguf
-
-SERVER
-
-Set up chroot.
-
- 1. Create symlink to slowcgi: $ ln -s /etc/rc.d/slowcgi /etc/rc.d/slowcgi_lex
- 2.
+Install: make install
+Start server: lexd -m <path to model>
+Connect to socket and type prompt: $ nc -U /var/run/lexd/sock
diff --git a/test_prompts.sh b/test_prompts.sh
index 1de3822..1f86d4a 100755
--- a/test_prompts.sh
+++ b/test_prompts.sh
@@ -3,7 +3,7 @@
# Usage: ./test_prompts.sh <model_path> [prompt_file]
SOCK_PATH="/var/run/lexd/sock"
-EXECUTABLE="./lex"
+EXECUTABLE="lexd"
# Mandatory Model Argument
MODEL_PATH="$1"