File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 1
1
set (TARGET llama-embedding )
2
2
add_executable (${TARGET} embedding.cpp )
3
3
install (TARGETS ${TARGET} RUNTIME )
4
- target_link_libraries (${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT} )
4
+ target_link_libraries (${TARGET} PRIVATE common llama llama-common-test ${CMAKE_THREAD_LIBS_INIT} )
5
5
target_compile_features (${TARGET} PRIVATE cxx_std_17 )
Original file line number Diff line number Diff line change
1
+ #include < algorithm>
2
+ #include < chrono>
3
+ #include < cstdint>
4
+ #include < cstdlib>
5
+ #include < ctime>
6
+ #include < fstream>
7
+ #include < thread>
8
+ #include < vector>
9
+
1
10
#include " arg.h"
2
11
#include " common.h"
12
+ #include " llama-cpp.h"
3
13
#include " log.h"
4
- #include " llama.h"
5
-
6
- #include < ctime>
7
- #include < algorithm>
8
14
9
15
#if defined(_MSC_VER)
10
16
#pragma warning(disable: 4244 4267) // possible loss of data
11
17
#endif
12
18
19
+ #include " load_into_memory.h"
20
+
13
21
static std::vector<std::string> split_lines (const std::string & s, const std::string & separator = " \n " ) {
14
22
std::vector<std::string> lines;
15
23
size_t start = 0 ;
@@ -94,7 +102,15 @@ int main(int argc, char ** argv) {
94
102
llama_numa_init (params.numa );
95
103
96
104
// load the model
97
- common_init_result llama_init = common_init_from_params (params);
105
+ common_init_result llama_init;
106
+ if (memory_configuration_env_is_set ()) {
107
+ llama_model_params mparams = common_model_params_to_llama (params);
108
+ common_init_result iparams;
109
+ llama_model * model = load_model_from_memory_configuration (params.model .path .c_str (), mparams);
110
+ llama_init = common_init_from_model_and_params (model, std::move (iparams), params);
111
+ } else {
112
+ llama_init = common_init_from_params (params);
113
+ }
98
114
99
115
llama_model * model = llama_init.model .get ();
100
116
llama_context * ctx = llama_init.context .get ();
You can’t perform that action at this time.
0 commit comments