Skip to content

Commit 769d0ab

Browse files
committed
Imatrix: first implementation attempt
1 parent 10c6501 commit 769d0ab

12 files changed

+1573
-16
lines changed

clip.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ class CLIPTextModel : public GGMLBlock {
661661
if (version == OPEN_CLIP_VIT_BIGG_14) {
662662
enum ggml_type wtype = GGML_TYPE_F32; // tensor_types.find(prefix + "text_projection") != tensor_types.end() ? tensor_types[prefix + "text_projection"] : GGML_TYPE_F32;
663663
params["text_projection"] = ggml_new_tensor_2d(ctx, wtype, projection_dim, hidden_size);
664+
ggml_set_name(params["text_projection"], (prefix + "text_projection").c_str());
664665
}
665666
}
666667

@@ -812,6 +813,7 @@ class CLIPProjection : public UnaryBlock {
812813
} else {
813814
params["weight"] = ggml_new_tensor_2d(ctx, wtype, in_features, out_features);
814815
}
816+
ggml_set_name(params["weight"], (prefix + "weight").c_str());
815817
}
816818

817819
public:

examples/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
22

3-
add_subdirectory(cli)
3+
add_subdirectory(cli)
4+
add_subdirectory(imatrix)

examples/cli/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ int main(int argc, const char* argv[]) {
800800
}
801801

802802
if (params.mode == CONVERT) {
803-
bool success = convert(params.model_path.c_str(), params.vae_path.c_str(), params.output_path.c_str(), params.wtype);
803+
bool success = convert(params.model_path.c_str(), params.vae_path.c_str(), params.output_path.c_str(), params.wtype,NULL);
804804
if (!success) {
805805
fprintf(stderr,
806806
"convert '%s'/'%s' to '%s' failed\n",

examples/imatrix/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(TARGET sd-imatrix)
2+
3+
add_executable(${TARGET} imatrix.cpp)
4+
install(TARGETS ${TARGET} RUNTIME)
5+
target_link_libraries(${TARGET} PRIVATE stable-diffusion ${CMAKE_THREAD_LIBS_INIT})
6+
target_link_libraries(${TARGET} PRIVATE ggml ${CMAKE_THREAD_LIBS_INIT})
7+
target_compile_features(${TARGET} PUBLIC cxx_std_11)

0 commit comments

Comments
 (0)