build: enforce C++17 and add gpt example
This commit is contained in:
+21
-1
@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(cenet CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_library(cenet INTERFACE
|
||||
include/cenet/mat.hpp
|
||||
@@ -20,3 +21,22 @@ target_link_libraries(mnist PRIVATE cenet)
|
||||
|
||||
add_executable(tokenizer example/tokenizer.cpp)
|
||||
target_link_libraries(tokenizer PRIVATE cenet)
|
||||
|
||||
add_executable(gpt example/gpt.cpp)
|
||||
target_link_libraries(gpt PRIVATE cenet)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
||||
)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_executable(math_test test/tensor.cpp)
|
||||
target_link_libraries(math_test GTest::gtest_main cenet)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(math_test)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "cenet/network.hpp"
|
||||
#include "tokenizer.hpp"
|
||||
|
||||
#include <cenet/cenet.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
static constexpr std::size_t VOCAB_SIZE = 2256;
|
||||
|
||||
using network_type = cenet::network<std::vector<std::uint32_t>, cenet::tok2vec_layer<2256, 512>>;
|
||||
|
||||
int main(void) {
|
||||
tokenizer<VOCAB_SIZE> bpe;
|
||||
if (!bpe.load("./gpt/shakespeare.bpe")) return 1;
|
||||
std::cout << "Vocabulary loaded!\n";
|
||||
|
||||
auto* gpt = new network_type();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user