From 04e285894245d4a312d9d13f1bfa1a473ae71d8a Mon Sep 17 00:00:00 2001 From: joshcarp Date: Tue, 7 May 2024 14:45:59 -0400 Subject: [PATCH] Cleanup --- examples/split-test/CMakeLists.txt | 5 ---- examples/split-test/split-test.cpp | 40 ------------------------------ 2 files changed, 45 deletions(-) delete mode 100644 examples/split-test/CMakeLists.txt delete mode 100644 examples/split-test/split-test.cpp diff --git a/examples/split-test/CMakeLists.txt b/examples/split-test/CMakeLists.txt deleted file mode 100644 index b9d5a539e..000000000 --- a/examples/split-test/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(TARGET split-test) -add_executable(${TARGET} split-test.cpp) -install(TARGETS ${TARGET} RUNTIME) -target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT}) -target_compile_features(${TARGET} PRIVATE cxx_std_11) diff --git a/examples/split-test/split-test.cpp b/examples/split-test/split-test.cpp deleted file mode 100644 index 58a6ce077..000000000 --- a/examples/split-test/split-test.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "ggml.h" - -int main() { - printf("split_test\n"); - // Initialization - struct ggml_init_params params = ggml_init_params{1024}; // Assuming this initializes memory - ggml_context *ctx = ggml_init(params); - - // Tensor Creation (Analogous to the PyTorch code) - int64_t size = 18 * 7 * 64; - int64_t dims[4] = {1, 18, 7, 64}; - ggml_tensor *tensor = ggml_new_tensor(ctx, GGML_TYPE_F32, 4, dims); - - // Initialize tensor data (Note: Simplified for this example) - float* tensor_data = (float*) tensor->data; - for (int i = 0; i < size; i++) { - tensor_data[i] = (float) i; - printf("%f", tensor_data[i]); - } - printf("\n"); - - // Reshaping and Transpose - // ... (You'll need ggml equivalents of reshape and transpose) - - // Splitting (We'll focus on this part) - int64_t num_q_heads = 12; - int64_t num_k_heads = 3; - int64_t num_v_heads = 3; - - ggml_tensor *a = ggml_view_3d(ctx, tensor, /*ne0*/1, /*ne1*/2, /*ne2*/3, /*nb1*/4, /*nb2*/5, /*offset*/6); - ggml_tensor *b = ggml_view_3d(ctx, tensor, /*ne0*/1, /*ne1*/2, /*ne2*/3, /*nb1*/4, /*nb2*/5, /*offset*/6); - ggml_tensor *c = ggml_view_3d(ctx, tensor, /*ne0*/1, /*ne1*/2, /*ne2*/3, /*nb1*/4, /*nb2*/5, /*offset*/6); - - // Accessing elements (assuming ggml provides similar access) - float *a_data = (float*) a->data; - std::cout << a_data[0] << std::endl; - - return 0; -}