Skip to content

Commit d99241e

Browse files
ngxsonarthw
authored andcommitted
common : refactor arg parser (ggml-org#9308)
* (wip) argparser v3 * migrated * add test * handle env * fix linux build * add export-docs example * fix build (2) * skip build test-arg-parser on windows * update server docs * bring back missing --alias * bring back --n-predict * clarify test-arg-parser * small correction * add comments * fix args with 2 values * refine example-specific args * no more lamba capture Co-authored-by: [email protected] * params.sparams * optimize more * export-docs --> gen-docs
1 parent 323c625 commit d99241e

File tree

33 files changed

+2229
-1930
lines changed

33 files changed

+2229
-1930
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ llama-batched-swift
6161
/rpc-server
6262
out/
6363
tmp/
64+
autogen-*.md
6465

6566
# Deprecated
6667

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ BUILD_TARGETS = \
3939
llama-tokenize \
4040
llama-vdot \
4141
llama-cvector-generator \
42+
llama-gen-docs \
4243
tests/test-c.o
4344

4445
# Binaries only useful for tests
4546
TEST_TARGETS = \
47+
tests/test-arg-parser \
4648
tests/test-autorelease \
4749
tests/test-backend-ops \
4850
tests/test-chat-template \
@@ -1441,6 +1443,12 @@ examples/server/%.hpp: examples/server/public/% Makefile
14411443
echo "unsigned int $${NAME}_len = $(shell cat $< | wc -c );" \
14421444
) > $@
14431445

1446+
llama-gen-docs: examples/gen-docs/gen-docs.cpp \
1447+
$(OBJ_ALL)
1448+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
1449+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
1450+
./llama-gen-docs
1451+
14441452
libllava.a: examples/llava/llava.cpp \
14451453
examples/llava/llava.h \
14461454
examples/llava/clip.cpp \
@@ -1498,6 +1506,11 @@ run-benchmark-matmult: llama-benchmark-matmult
14981506

14991507
.PHONY: run-benchmark-matmult swift
15001508

1509+
tests/test-arg-parser: tests/test-arg-parser.cpp \
1510+
$(OBJ_ALL)
1511+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
1512+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
1513+
15011514
tests/test-llama-grammar: tests/test-llama-grammar.cpp \
15021515
$(OBJ_ALL)
15031516
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)

0 commit comments

Comments
 (0)