We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b5011c commit 2c6ed76Copy full SHA for 2c6ed76
tools/mtmd/clip.cpp
@@ -384,9 +384,16 @@ struct clip_ctx {
384
if (!backend_cpu) {
385
throw std::runtime_error("failed to initialize CPU backend");
386
}
387
- backend = ctx_params.use_gpu
388
- ? ggml_backend_init_by_type(GGML_BACKEND_DEVICE_TYPE_GPU, nullptr)
389
- : nullptr;
+ backend = nullptr;
+ if (ctx_params.use_gpu) {
+ auto backend_name = std::getenv("MTMD_BACKEND_DEVICE");
390
+ if (backend_name != nullptr) {
391
+ backend = ggml_backend_init_by_name(backend_name, nullptr);
392
+ }
393
+ if (!backend) {
394
+ backend = ggml_backend_init_by_type(GGML_BACKEND_DEVICE_TYPE_GPU, nullptr);
395
396
397
398
if (backend) {
399
LOG_INF("%s: CLIP using %s backend\n", __func__, ggml_backend_name(backend));
0 commit comments