From: Howard Su Date: Mon, 3 Jul 2023 18:43:55 +0000 (+0800) Subject: Fix crash of test-tokenizer-0 under Debug build (#2064) X-Git-Tag: gguf-v0.4.0~529 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=cc45a7feb8412e84ff292207621412fffc0d3d51;p=pkg%2Fggml%2Fsources%2Fllama.cpp Fix crash of test-tokenizer-0 under Debug build (#2064) * Fix crash of test-tokenizer-0 under Debug build * Change per comment --- diff --git a/ggml-cuda.cu b/ggml-cuda.cu index 50df20ed..0b12a9e7 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -2835,7 +2835,7 @@ void ggml_cuda_transform_tensor(void * data, struct ggml_tensor * tensor) { } void ggml_cuda_free_data(struct ggml_tensor * tensor) { - if (tensor->backend != GGML_BACKEND_GPU && tensor->backend != GGML_BACKEND_GPU_SPLIT) { + if (!tensor || (tensor->backend != GGML_BACKEND_GPU && tensor->backend != GGML_BACKEND_GPU_SPLIT) ) { return; } diff --git a/llama.cpp b/llama.cpp index f48a6ca7..7419b03b 100644 --- a/llama.cpp +++ b/llama.cpp @@ -194,8 +194,8 @@ struct llama_layer { }; struct llama_kv_cache { - struct ggml_tensor * k; - struct ggml_tensor * v; + struct ggml_tensor * k = NULL; + struct ggml_tensor * v = NULL; struct ggml_context * ctx = NULL;