Skip to content

Commit

Permalink
Removing hacky include to llama.cpp from grammar integration test now…
Browse files Browse the repository at this point in the history
… that needed functions are available via internal API.
  • Loading branch information
HanClinto committed Apr 4, 2024
1 parent b7264d6 commit b930945
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ tests/test-grammar-parser: tests/test-grammar-parser.cpp ggml.o llama.o grammar-
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)

tests/test-grammar-integration: tests/test-grammar-integration.cpp ggml.o grammar-parser.o $(OBJS)
tests/test-grammar-integration: tests/test-grammar-integration.cpp ggml.o llama.o grammar-parser.o $(OBJS)
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)

Expand Down
8 changes: 6 additions & 2 deletions tests/test-grammar-integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
#undef NDEBUG
#endif

#include "llama.cpp" // TODO: not great
#define LLAMA_API_INTERNAL

#include "ggml.h"
#include "llama.h"
#include "grammar-parser.h"
#include "unicode.h"
#include <cassert>
#include <string>

Expand All @@ -30,7 +34,7 @@ expr ::= term ("+" term)*
term ::= numero
number ::= [0-9]+)""";

fprintf(stderr, "NOTE: Error message (\"error parsing grammar\") expected on following line during successful test:\n");
fprintf(stderr, "NOTE: Error message (\"parse: error parsing grammar: Undefined rule identifier 'numero'\") expected on following line during successful test:\n");

grammar_parser::parse_state parsed_grammar = grammar_parser::parse(grammar_str.c_str());

Expand Down

0 comments on commit b930945

Please sign in to comment.