Skip to content

Commit

Permalink
Fix state issues with reloading model.
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Treat <treat.adam@gmail.com>
  • Loading branch information
manyoso committed Feb 21, 2024
1 parent 4fc4d94 commit 67bbce4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion gpt4all-chat/chatllm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,11 @@ void ChatLLM::unloadModel()
if (!isModelLoaded() || m_isServer)
return;

emit modelLoadingPercentageChanged(0.0f);
if (!m_forceUnloadModel || !m_shouldBeLoaded)
emit modelLoadingPercentageChanged(0.0f);
else
emit modelLoadingPercentageChanged(std::numeric_limits<float>::min()); // small non-zero positive value

saveState();
#if defined(DEBUG_MODEL_LOADING)
qDebug() << "unloadModel" << m_llmThread.objectName() << m_llModelInfo.model;
Expand Down
2 changes: 1 addition & 1 deletion gpt4all-chat/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ Window {

MyMiniButton {
id: ejectButton
visible: currentChat.isModelLoaded
visible: currentChat.isModelLoaded && !window.isCurrentlyLoading
z: 500
anchors.right: parent.right
anchors.rightMargin: 50
Expand Down

0 comments on commit 67bbce4

Please sign in to comment.