chat: clearer CPU fallback messages

This commit is contained in:
Cebtenzzre 2023-10-06 11:30:55 -04:00 committed by AT
parent eec906aa05
commit 5fe685427a
3 changed files with 6 additions and 6 deletions

View File

@ -303,11 +303,11 @@ bool LLamaModel::initializeGPUDevice(const LLModel::GPUDevice &device, std::stri
vkDevice.vendor = device.vendor; vkDevice.vendor = device.vendor;
result = ggml_vk_init_device(vkDevice); result = ggml_vk_init_device(vkDevice);
if (!result && unavail_reason) { if (!result && unavail_reason) {
*unavail_reason = "failed to init device"; *unavail_reason = "failed to init GPU";
} }
#else #else
if (unavail_reason) { if (unavail_reason) {
*unavail_reason = "built without kompute"; *unavail_reason = "built without Kompute";
} }
#endif #endif
return result; return result;

View File

@ -99,7 +99,7 @@ public:
virtual bool initializeGPUDevice(size_t /*memoryRequired*/, const std::string& /*device*/) { return false; } virtual bool initializeGPUDevice(size_t /*memoryRequired*/, const std::string& /*device*/) { return false; }
virtual bool initializeGPUDevice(const GPUDevice &/*device*/, std::string *unavail_reason = nullptr) { virtual bool initializeGPUDevice(const GPUDevice &/*device*/, std::string *unavail_reason = nullptr) {
if (unavail_reason) { if (unavail_reason) {
*unavail_reason = "unsupported model type"; *unavail_reason = "model has no GPU support";
} }
return false; return false;
} }

View File

@ -287,7 +287,7 @@ bool ChatLLM::loadModel(const ModelInfo &modelInfo)
if (!device) { if (!device) {
// GPU not available // GPU not available
} else if (!m_llModelInfo.model->initializeGPUDevice(*device, &unavail_reason)) { } else if (!m_llModelInfo.model->initializeGPUDevice(*device, &unavail_reason)) {
emit reportFallbackReason(QString::fromStdString("<br>Using CPU: " + unavail_reason)); emit reportFallbackReason(QString::fromStdString("<br>" + unavail_reason));
} else { } else {
actualDevice = QString::fromStdString(device->name); actualDevice = QString::fromStdString(device->name);
} }
@ -302,14 +302,14 @@ bool ChatLLM::loadModel(const ModelInfo &modelInfo)
} else if (!success) { } else if (!success) {
// llama_init_from_file returned nullptr // llama_init_from_file returned nullptr
emit reportDevice("CPU"); emit reportDevice("CPU");
emit reportFallbackReason("<br>Using CPU: loading failed (out of VRAM?)"); emit reportFallbackReason("<br>GPU loading failed (out of VRAM?)");
success = m_llModelInfo.model->loadModel(filePath.toStdString()); success = m_llModelInfo.model->loadModel(filePath.toStdString());
} else if (!m_llModelInfo.model->usingGPUDevice()) { } else if (!m_llModelInfo.model->usingGPUDevice()) {
// ggml_vk_init was not called in llama.cpp // ggml_vk_init was not called in llama.cpp
// We might have had to fallback to CPU after load if the model is not possible to accelerate // We might have had to fallback to CPU after load if the model is not possible to accelerate
// for instance if the quantization method is not supported on Vulkan yet // for instance if the quantization method is not supported on Vulkan yet
emit reportDevice("CPU"); emit reportDevice("CPU");
emit reportFallbackReason("<br>Using CPU: unsupported model or quant"); emit reportFallbackReason("<br>model or quant has no GPU support");
} }
MySettings::globalInstance()->setAttemptModelLoad(QString()); MySettings::globalInstance()->setAttemptModelLoad(QString());