mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Fixes for linux and macosx.
This commit is contained in:
parent
b41b1210cf
commit
ae91bfa48a
@ -45,13 +45,21 @@ install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
|
||||
|
||||
set(CPACK_GENERATOR "IFW")
|
||||
|
||||
if (WIN32)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
|
||||
find_program(LINUXDEPLOYQT linuxdeployqt HINTS ${_qt_bin_dir})
|
||||
message(AUTHOR_WARNING "heeeeeee ${LINUXDEPLOYQT}")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-linux.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake" @ONLY)
|
||||
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake)
|
||||
set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows)
|
||||
find_program(WINDEPLOYQT windeployqt HINTS ${_qt_bin_dir})
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-windows.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/cmake/deploy-qt-windows.cmake" @ONLY)
|
||||
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-windows.cmake)
|
||||
set(CPACK_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.5")
|
||||
endif (WIN32)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "1")
|
||||
|
2
gptj.cpp
2
gptj.cpp
@ -650,7 +650,7 @@ bool GPTJ::loadModel(const std::string &modelPath, std::istream &fin) {
|
||||
|
||||
// load the model
|
||||
if (!gptj_model_load(modelPath, fin, d_ptr->model, d_ptr->vocab)) {
|
||||
std::cerr << "GPT-J ERROR: failed to load model from" << modelPath;
|
||||
std::cerr << "GPT-J ERROR: failed to load model from " << modelPath;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
12
llm.cpp
12
llm.cpp
@ -4,6 +4,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QResource>
|
||||
#include <fstream>
|
||||
|
||||
class MyLLM: public LLM { };
|
||||
Q_GLOBAL_STATIC(MyLLM, llmInstance)
|
||||
@ -28,13 +29,12 @@ bool GPTJObject::loadModel()
|
||||
return true;
|
||||
|
||||
QString modelName("ggml-model-q4_0.bin");
|
||||
QFile file(QCoreApplication::applicationDirPath() + QDir::separator() + modelName);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QString fileName = QCoreApplication::applicationDirPath() + QDir::separator() + modelName;
|
||||
QFile file(fileName);
|
||||
if (file.exists()) {
|
||||
|
||||
QByteArray data = file.readAll();
|
||||
std::istringstream iss(data.toStdString());
|
||||
|
||||
m_gptj->loadModel(modelName.toStdString(), iss);
|
||||
auto fin = std::ifstream(fileName.toStdString(), std::ios::binary);
|
||||
m_gptj->loadModel(modelName.toStdString(), fin);
|
||||
emit isModelLoadedChanged();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user