[WIP] clean up hello_world #includes and CMakeLists.txt

This commit is contained in:
austinvhuang 2024-03-07 01:04:25 -05:00
parent e781007836
commit 49e654258d
2 changed files with 3 additions and 21 deletions

View File

@ -13,21 +13,16 @@
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 3.11) cmake_minimum_required(VERSION 3.11)
project(hello_world) project(hello_world)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent) include(FetchContent)
FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG da250571a45826b21eebbddc1e50d0c1137dee5f) FetchContent_Declare(highway GIT_REPOSITORY https://github.com/google/highway.git GIT_TAG da250571a45826b21eebbddc1e50d0c1137dee5f)
FetchContent_MakeAvailable(highway) FetchContent_MakeAvailable(highway)
FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 53de76561cfc149d3c01037f0595669ad32a5e7c) FetchContent_Declare(sentencepiece GIT_REPOSITORY https://github.com/google/sentencepiece GIT_TAG 53de76561cfc149d3c01037f0595669ad32a5e7c)
FetchContent_MakeAvailable(sentencepiece) FetchContent_MakeAvailable(sentencepiece)
FetchContent_Declare(gemma GIT_REPOSITORY https://github.com/google/gemma.cpp.git GIT_TAG e781007836ec034236e90cc4d313d0a8c481bce6)
FetchContent_Declare(gemma GIT_REPOSITORY https://github.com/google/gemma.cpp.git GIT_TAG 7042316013d7e2ad06532f420b551802ec114f89)
FetchContent_MakeAvailable(gemma) FetchContent_MakeAvailable(gemma)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
@ -35,10 +30,8 @@ if(NOT CMAKE_BUILD_TYPE)
endif() endif()
add_executable(hello_world run.cc) add_executable(hello_world run.cc)
target_sources(hello_world PRIVATE ${SOURCES})
set_property(TARGET hello_world PROPERTY CXX_STANDARD 17) set_property(TARGET hello_world PROPERTY CXX_STANDARD 17)
target_link_libraries(hello_world hwy hwy_contrib sentencepiece libgemma) target_link_libraries(hello_world hwy hwy_contrib sentencepiece libgemma)
target_include_directories(hello_world PRIVATE ./)
FetchContent_GetProperties(sentencepiece) FetchContent_GetProperties(sentencepiece)
target_include_directories(hello_world PRIVATE ${sentencepiece_SOURCE_DIR}) target_include_directories(hello_world PRIVATE ${sentencepiece_SOURCE_DIR})
target_compile_definitions(hello_world PRIVATE $<$<PLATFORM_ID:Windows>:_CRT_SECURE_NO_WARNINGS NOMINMAX>) target_compile_definitions(hello_world PRIVATE $<$<PLATFORM_ID:Windows>:_CRT_SECURE_NO_WARNINGS NOMINMAX>)

View File

@ -1,23 +1,12 @@
#include <iostream> #include <iostream>
// copybara:import_next_line:gemma_cpp // copybara:import_next_line:gemma_cpp
#include "compression/compress.h" #include "gemma.h"
// copybara:end // copybara:end
// copybara:import_next_line:gemma_cpp // copybara:import_next_line:gemma_cpp
#include "gemma.h" // Gemma #include "util/args.h"
// copybara:end // copybara:end
// copybara:import_next_line:gemma_cpp
#include "util/args.h" // HasHelp
// copybara:end
// copybara:import_next_line:gemma_cpp
#include "configs.h"
// copybara:end
#include "hwy/base.h"
#include "hwy/contrib/thread_pool/thread_pool.h" #include "hwy/contrib/thread_pool/thread_pool.h"
#include "hwy/highway.h"
#include "hwy/per_target.h"
#include "hwy/profiler.h"
#include "hwy/timer.h"
std::vector<int> tokenize( std::vector<int> tokenize(
std::string prompt_string, std::string prompt_string,