Add assert to make sure we only allocate temp buffer for non-CPU backend tensor

Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
This commit is contained in:
Howard Su 2023-06-12 20:19:26 +08:00 committed by GitHub
parent 34ca572e84
commit 61726bd942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -762,6 +762,7 @@ struct llama_model_loader {
// allocate temp buffer if not using mmap
if (!use_mmap && lt.data == NULL) {
GGML_ASSERT(lt.ggml_tensor->backend != GGML_BACKEND_CPU);
lt.data = (uint8_t*)malloc(ggml_nbytes(lt.ggml_tensor));
}