22 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # dependencies
2 |
3 | find_package(Threads REQUIRED)
4 |
5 | # third-party
6 |
7 | if (WHISPER_SUPPORT_SDL2)
8 | # SDL2
9 | find_package(SDL2 REQUIRED)
10 |
11 | string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
12 |
13 | message(STATUS "SDL2_INCLUDE_DIRS = ${SDL2_INCLUDE_DIRS}")
14 | message(STATUS "SDL2_LIBRARIES = ${SDL2_LIBRARIES}")
15 | endif()
16 |
17 | # examples
18 |
19 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
20 |
21 | if (EMSCRIPTEN)
22 | add_subdirectory(whisper.wasm)
23 | add_subdirectory(stream.wasm)
24 | add_subdirectory(command.wasm)
25 | add_subdirectory(talk.wasm)
26 | else()
27 | add_subdirectory(main)
28 | add_subdirectory(stream)
29 | add_subdirectory(command)
30 | add_subdirectory(bench)
31 | endif()
32 |
--------------------------------------------------------------------------------
/cmake/GitVars.cmake:
--------------------------------------------------------------------------------
1 | find_package(Git)
2 |
3 | # the commit's SHA1
4 | execute_process(COMMAND
5 | "${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=8
6 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
7 | OUTPUT_VARIABLE GIT_SHA1
8 | ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
9 |
10 | # the date of the commit
11 | execute_process(COMMAND
12 | "${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
13 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
14 | OUTPUT_VARIABLE GIT_DATE
15 | ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
16 |
17 | # the subject of the commit
18 | execute_process(COMMAND
19 | "${GIT_EXECUTABLE}" log -1 --format=%s
20 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
21 | OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
22 | ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
23 |
--------------------------------------------------------------------------------
/examples/talk.wasm/gpt-2.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // TODO: Change to C-style API and move to ./examples for easy reuse.
4 |
5 | #include