Skip to content

Commit 0fb1e25

Browse files
committed
Fix cpu build inference with demo scripts
Signed-off-by: Molly Sophia <mollysophia379@gmail.com>
1 parent be863c6 commit 0fb1e25

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rwkv.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct rwkv_context * rwkv_init_from_file(const char * file_path, const uint32_t
8080
ctx->n_threads = n_threads;
8181

8282
if (n_gpu_layers) {
83-
ggml_backend_t backend;
83+
ggml_backend_t backend = nullptr;
8484

8585
#ifdef GGML_USE_CUDA
8686
backend = ggml_backend_cuda_init(0);
@@ -97,9 +97,9 @@ struct rwkv_context * rwkv_init_from_file(const char * file_path, const uint32_t
9797
RWKV_ENSURE_OR_NULL(backend);
9898
ggml_backend_blas_set_n_threads(backend, ctx->n_threads);
9999
#endif
100-
RWKV_ENSURE_OR_NULL(backend);
101-
102-
ctx->model->backends.push_back(backend);
100+
if (backend != nullptr) {
101+
ctx->model->backends.push_back(backend);
102+
}
103103
}
104104

105105
ggml_backend_t cpu_backend = ggml_backend_cpu_init();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy