Skip to content

Commit

Permalink
Fix crash with chatgpt and gpu layers.
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Treat <[email protected]>
  • Loading branch information
manyoso committed Feb 22, 2024
1 parent e7f2ff1 commit ef518fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions gpt4all-chat/modellist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ void ModelInfo::setGpuLayers(int l)

int ModelInfo::maxGpuLayers() const
{
if (isOnline) return -1;
if (m_maxGpuLayers != -1) return m_maxGpuLayers;
auto path = (dirpath + filename()).toStdString();
int layers = LLModel::Implementation::layerCount(path);
Expand Down
32 changes: 16 additions & 16 deletions gpt4all-chat/qml/ModelSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ MySettingsTab {
}

MySettingsLabel {
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("System Prompt")
Layout.row: 6
Layout.column: 0
Expand All @@ -163,7 +163,7 @@ MySettingsTab {

Rectangle {
id: systemPrompt
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
Layout.row: 7
Layout.column: 0
Layout.columnSpan: 2
Expand Down Expand Up @@ -317,14 +317,14 @@ MySettingsTab {

MySettingsLabel {
id: contextLengthLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("Context Length")
Layout.row: 0
Layout.column: 0
}
MyTextField {
id: contextLengthField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.contextLength
font.pixelSize: theme.fontSizeLarge
color: theme.textColor
Expand Down Expand Up @@ -454,14 +454,14 @@ MySettingsTab {
}
MySettingsLabel {
id: topKLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("Top K")
Layout.row: 2
Layout.column: 2
}
MyTextField {
id: topKField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.topK
color: theme.textColor
font.pixelSize: theme.fontSizeLarge
Expand Down Expand Up @@ -499,14 +499,14 @@ MySettingsTab {
}
MySettingsLabel {
id: maxLengthLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("Max Length")
Layout.row: 0
Layout.column: 2
}
MyTextField {
id: maxLengthField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.maxLength
color: theme.textColor
font.pixelSize: theme.fontSizeLarge
Expand Down Expand Up @@ -545,14 +545,14 @@ MySettingsTab {

MySettingsLabel {
id: batchSizeLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("Prompt Batch Size")
Layout.row: 1
Layout.column: 0
}
MyTextField {
id: batchSizeField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.promptBatchSize
color: theme.textColor
font.pixelSize: theme.fontSizeLarge
Expand Down Expand Up @@ -590,14 +590,14 @@ MySettingsTab {
}
MySettingsLabel {
id: repeatPenaltyLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("Repeat Penalty")
Layout.row: 3
Layout.column: 0
}
MyTextField {
id: repeatPenaltyField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.repeatPenalty
color: theme.textColor
font.pixelSize: theme.fontSizeLarge
Expand Down Expand Up @@ -635,14 +635,14 @@ MySettingsTab {
}
MySettingsLabel {
id: repeatPenaltyTokensLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("Repeat Penalty Tokens")
Layout.row: 3
Layout.column: 2
}
MyTextField {
id: repeatPenaltyTokenField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.repeatPenaltyTokens
color: theme.textColor
font.pixelSize: theme.fontSizeLarge
Expand Down Expand Up @@ -681,14 +681,14 @@ MySettingsTab {

MySettingsLabel {
id: gpuLayersLabel
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: qsTr("GPU Layers")
Layout.row: 4
Layout.column: 0
}
MyTextField {
id: gpuLayersField
visible: !root.currentModelInfo.isChatGPT
visible: !root.currentModelInfo.isOnline
text: root.currentModelInfo.gpuLayers
font.pixelSize: theme.fontSizeLarge
color: theme.textColor
Expand Down

0 comments on commit ef518fa

Please sign in to comment.