mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-02 00:57:09 +00:00
Link against ggml in bin so we can get the available devices without loading a model.
This commit is contained in:
@@ -263,12 +263,6 @@ bool ChatLLM::loadModel(const ModelInfo &modelInfo)
|
||||
if (m_llModelInfo.model) {
|
||||
// Update the settings that a model is being loaded and update the device list
|
||||
MySettings::globalInstance()->setAttemptModelLoad(filePath);
|
||||
std::vector<LLModel::GPUDevice> devices = m_llModelInfo.model->availableGPUDevices(0);
|
||||
QVector<QString> deviceList{ "Auto" };
|
||||
for (LLModel::GPUDevice &d : devices)
|
||||
deviceList << QString::fromStdString(d.name);
|
||||
deviceList << "CPU";
|
||||
MySettings::globalInstance()->setDeviceList(deviceList);
|
||||
|
||||
// Pick the best match for the device
|
||||
QString actualDevice = m_llModelInfo.model->implementation().buildVariant() == "metal" ? "Metal" : "CPU";
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "mysettings.h"
|
||||
#include "modellist.h"
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@@ -63,6 +64,13 @@ MySettings::MySettings()
|
||||
: QObject{nullptr}
|
||||
{
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
|
||||
std::vector<LLModel::GPUDevice> devices = LLModel::availableGPUDevices();
|
||||
QVector<QString> deviceList{ "Auto" };
|
||||
for (LLModel::GPUDevice &d : devices)
|
||||
deviceList << QString::fromStdString(d.name);
|
||||
deviceList << "CPU";
|
||||
setDeviceList(deviceList);
|
||||
}
|
||||
|
||||
Q_INVOKABLE QVector<QString> MySettings::deviceList() const
|
||||
|
Reference in New Issue
Block a user