Skip to content

Commit 51d681e

Browse files
committed
add GemmaTokenizer
1 parent 6b675a5 commit 51d681e

7 files changed

Lines changed: 280 additions & 69 deletions

File tree

examples/cli/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ add_executable(${TARGET}
77
image_metadata.cpp
88
main.cpp
99
)
10+
target_include_directories(${TARGET} PRIVATE
11+
"${CMAKE_CURRENT_SOURCE_DIR}/.."
12+
"${PROJECT_SOURCE_DIR}/src"
13+
)
1014
install(TARGETS ${TARGET} RUNTIME)
1115
target_link_libraries(${TARGET} PRIVATE stable-diffusion zip ${CMAKE_THREAD_LIBS_INIT})
1216
if(SD_WEBP)

examples/cli/main.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "common/media_io.h"
2020
#include "common/resource_owners.hpp"
2121
#include "image_metadata.h"
22+
#include "llm.hpp"
2223

2324
namespace fs = std::filesystem;
2425

@@ -498,6 +499,15 @@ int main(int argc, const char* argv[]) {
498499
SDContextParams ctx_params;
499500
SDGenerationParams gen_params;
500501

502+
cli_params.verbose = true;
503+
sd_set_log_callback(sd_log_cb, (void*)&cli_params);
504+
LLM::GemmaTokenizer tokenizer;
505+
auto tokens = tokenizer.tokenize("<html> 一只可爱的小猫");
506+
for (auto token : tokens) {
507+
LOG_INFO("%d", token);
508+
}
509+
return 0;
510+
501511
parse_args(argc, argv, cli_params, ctx_params, gen_params);
502512
sd_set_log_callback(sd_log_cb, (void*)&cli_params);
503513
log_verbose = cli_params.verbose;

0 commit comments

Comments
 (0)