2023-06-30 13:50:09 +00:00
import QtCore
import QtQuick
import QtQuick . Controls
import QtQuick . Controls . Basic
import QtQuick . Layouts
2023-07-01 15:34:21 +00:00
import modellist
2023-06-30 13:50:09 +00:00
import mysettings
2024-03-09 23:35:10 +00:00
import chatlistmodel
2023-06-30 13:50:09 +00:00
MySettingsTab {
2023-07-01 15:34:21 +00:00
onRestoreDefaultsClicked: {
MySettings . restoreModelDefaults ( root . currentModelInfo ) ;
}
2024-06-28 16:57:57 +00:00
title: qsTr ( "Model" )
2023-06-30 13:50:09 +00:00
contentItem: GridLayout {
2023-07-01 15:34:21 +00:00
id: root
columns: 3
2023-06-30 13:50:09 +00:00
rowSpacing: 10
columnSpacing: 10
2024-06-29 00:34:03 +00:00
enabled: ModelList . selectableModels . count !== 0
2023-06-30 13:50:09 +00:00
2023-07-01 15:34:21 +00:00
property var currentModelName: comboBox . currentText
property var currentModelId: comboBox . currentValue
property var currentModelInfo: ModelList . modelInfo ( root . currentModelId )
2024-06-28 16:57:57 +00:00
Label {
2024-06-24 22:49:23 +00:00
Layout.row: 1
2023-07-01 15:34:21 +00:00
Layout.column: 0
2024-06-28 16:57:57 +00:00
Layout.bottomMargin: 10
color: theme . settingsTitleTextColor
font.pixelSize: theme . fontSizeBannerSmall
font.bold: true
text: qsTr ( "Model Settings" )
2023-07-01 15:34:21 +00:00
}
RowLayout {
Layout.fillWidth: true
2024-06-24 22:49:23 +00:00
Layout.row: 2
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.columnSpan: 2
spacing: 10
MyComboBox {
id: comboBox
Layout.fillWidth: true
2024-06-29 00:34:03 +00:00
model: ModelList . selectableModels
2023-07-01 15:34:21 +00:00
valueRole: "id"
textRole: "name"
2024-03-11 18:00:33 +00:00
currentIndex: {
var i = comboBox . indexOfValue ( ChatListModel . currentChat . modelInfo . id ) ;
if ( i >= 0 )
return i ;
return 0 ;
}
2023-07-01 15:34:21 +00:00
contentItem: Text {
leftPadding: 10
rightPadding: 20
text: comboBox . currentText
font: comboBox . font
color: theme . textColor
verticalAlignment: Text . AlignVCenter
elide: Text . ElideRight
}
delegate: ItemDelegate {
2024-07-10 14:36:20 +00:00
width: comboBox . width - 20
2023-07-01 15:34:21 +00:00
contentItem: Text {
text: name
color: theme . textColor
font: comboBox . font
elide: Text . ElideRight
verticalAlignment: Text . AlignVCenter
}
background: Rectangle {
2024-07-10 14:36:20 +00:00
radius: 10
color: highlighted ? theme.menuHighlightColor : theme . menuBackgroundColor
2023-07-01 15:34:21 +00:00
}
highlighted: comboBox . highlightedIndex === index
}
}
2024-01-22 19:41:47 +00:00
MySettingsButton {
2023-07-01 15:34:21 +00:00
id: cloneButton
text: qsTr ( "Clone" )
onClicked: {
var id = ModelList . clone ( root . currentModelInfo ) ;
comboBox . currentIndex = comboBox . indexOfValue ( id ) ;
}
}
2024-01-22 19:41:47 +00:00
MySettingsDestructiveButton {
2023-07-01 15:34:21 +00:00
id: removeButton
enabled: root . currentModelInfo . isClone
text: qsTr ( "Remove" )
onClicked: {
2024-03-05 16:31:31 +00:00
ModelList . removeClone ( root . currentModelInfo ) ;
2023-07-01 15:34:21 +00:00
comboBox . currentIndex = 0 ;
}
}
}
RowLayout {
2024-06-24 22:49:23 +00:00
Layout.row: 3
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.topMargin: 15
spacing: 10
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2024-06-28 16:57:57 +00:00
text: qsTr ( "Name" )
2023-07-01 15:34:21 +00:00
}
}
MyTextField {
id: uniqueNameField
text: root . currentModelName
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2023-07-01 15:34:21 +00:00
enabled: root . currentModelInfo . isClone || root . currentModelInfo . description === ""
2024-06-24 22:49:23 +00:00
Layout.row: 4
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.columnSpan: 2
Layout.fillWidth: true
Connections {
target: MySettings
function onNameChanged ( ) {
uniqueNameField . text = root . currentModelInfo . name ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
uniqueNameField . text = root . currentModelInfo . name ;
}
}
onTextChanged: {
if ( text !== "" && ModelList . isUniqueName ( text ) ) {
MySettings . setModelName ( root . currentModelInfo , text ) ;
}
}
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
text: qsTr ( "Model File" )
2024-06-24 22:49:23 +00:00
Layout.row: 5
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.topMargin: 15
}
MyTextField {
text: root . currentModelInfo . filename
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2023-07-01 15:34:21 +00:00
enabled: false
2024-06-24 22:49:23 +00:00
Layout.row: 6
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.columnSpan: 2
Layout.fillWidth: true
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-22 19:41:47 +00:00
text: qsTr ( "System Prompt" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Prefixed at the beginning of every conversation. Must contain the appropriate framing tokens." )
2024-06-24 22:49:23 +00:00
Layout.row: 7
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.topMargin: 15
}
Rectangle {
id: systemPrompt
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-06-24 22:49:23 +00:00
Layout.row: 8
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.columnSpan: 2
Layout.fillWidth: true
color: "transparent"
2023-07-06 21:10:57 +00:00
Layout.minimumHeight: Math . max ( 100 , systemPromptArea . contentHeight + 20 )
2024-01-22 19:41:47 +00:00
MyTextArea {
2023-07-01 15:34:21 +00:00
id: systemPromptArea
anchors.fill: parent
text: root . currentModelInfo . systemPrompt
Connections {
target: MySettings
function onSystemPromptChanged ( ) {
systemPromptArea . text = root . currentModelInfo . systemPrompt ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
systemPromptArea . text = root . currentModelInfo . systemPrompt ;
}
}
onTextChanged: {
MySettings . setModelSystemPrompt ( root . currentModelInfo , text )
}
Accessible.role: Accessible . EditableText
}
}
RowLayout {
2024-06-24 22:49:23 +00:00
Layout.row: 9
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.columnSpan: 2
Layout.topMargin: 15
spacing: 10
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: promptTemplateLabel
2024-01-22 19:41:47 +00:00
text: qsTr ( "Prompt Template" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "The template that wraps every prompt." )
2023-07-01 15:34:21 +00:00
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: promptTemplateLabelHelp
text: qsTr ( "Must contain the string \"%1\" to be replaced with the user's input." )
color: theme . textErrorColor
visible: templateTextArea . text . indexOf ( "%1" ) === - 1
wrapMode: TextArea . Wrap
}
}
Rectangle {
id: promptTemplate
2024-06-24 22:49:23 +00:00
Layout.row: 10
2023-07-01 15:34:21 +00:00
Layout.column: 0
Layout.columnSpan: 2
Layout.fillWidth: true
2023-07-06 21:10:57 +00:00
Layout.minimumHeight: Math . max ( 100 , templateTextArea . contentHeight + 20 )
2023-07-01 15:34:21 +00:00
color: "transparent"
clip: true
2024-01-22 19:41:47 +00:00
MyTextArea {
2023-07-01 15:34:21 +00:00
id: templateTextArea
anchors.fill: parent
text: root . currentModelInfo . promptTemplate
Connections {
target: MySettings
function onPromptTemplateChanged ( ) {
templateTextArea . text = root . currentModelInfo . promptTemplate ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
templateTextArea . text = root . currentModelInfo . promptTemplate ;
}
}
onTextChanged: {
if ( templateTextArea . text . indexOf ( "%1" ) !== - 1 ) {
MySettings . setModelPromptTemplate ( root . currentModelInfo , text )
}
}
Accessible.role: Accessible . EditableText
Accessible.name: promptTemplateLabel . text
Accessible.description: promptTemplateLabelHelp . text
}
}
Rectangle {
id: optionalImageRect
visible: false // FIXME: for later
Layout.row: 2
2023-06-30 13:50:09 +00:00
Layout.column: 1
2023-07-01 15:34:21 +00:00
Layout.rowSpan: 5
Layout.alignment: Qt . AlignHCenter
Layout.fillHeight: true
Layout.maximumWidth: height
Layout.topMargin: 35
Layout.bottomMargin: 35
Layout.leftMargin: 35
width: 3000
radius: 10
color: "transparent"
Item {
anchors.centerIn: parent
height: childrenRect . height
Image {
id: img
anchors.horizontalCenter: parent . horizontalCenter
width: 100
height: 100
source: "qrc:/gpt4all/icons/image.svg"
}
Text {
text: qsTr ( "Add\noptional image" )
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2023-07-01 15:34:21 +00:00
anchors.top: img . bottom
anchors.horizontalCenter: parent . horizontalCenter
wrapMode: TextArea . Wrap
horizontalAlignment: Qt . AlignHCenter
color: theme . mutedTextColor
}
}
}
GridLayout {
Layout.row: 11
Layout.column: 0
Layout.columnSpan: 2
Layout.topMargin: 15
2023-06-30 13:50:09 +00:00
Layout.fillWidth: true
2023-07-01 15:34:21 +00:00
columns: 4
2024-06-24 22:49:23 +00:00
rowSpacing: 30
2023-07-01 15:34:21 +00:00
columnSpacing: 10
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-12-16 22:58:15 +00:00
id: contextLengthLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-22 19:41:47 +00:00
text: qsTr ( "Context Length" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Number of input and output tokens the model sees." )
2023-12-16 22:58:15 +00:00
Layout.row: 0
Layout.column: 0
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-12-16 22:58:15 +00:00
}
2024-07-08 21:01:30 +00:00
Item {
2023-12-16 22:58:15 +00:00
Layout.row: 0
Layout.column: 1
2024-07-08 21:01:30 +00:00
Layout.fillWidth: true
Layout.maximumWidth: 200
Layout.margins: 0
height: contextLengthField . height
MyTextField {
id: contextLengthField
anchors.left: parent . left
anchors.verticalCenter: parent . verticalCenter
visible: ! root . currentModelInfo . isOnline
text: root . currentModelInfo . contextLength
font.pixelSize: theme . fontSizeLarge
color: theme . textColor
ToolTip.text: qsTr ( "Maximum combined prompt/response tokens before information is lost.\nUsing more context than the model was trained on will yield poor results.\nNOTE: Does not take effect until you reload the model." )
ToolTip.visible: hovered
Connections {
target: MySettings
function onContextLengthChanged ( ) {
contextLengthField . text = root . currentModelInfo . contextLength ;
}
2023-12-16 22:58:15 +00:00
}
2024-07-08 21:01:30 +00:00
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
contextLengthField . text = root . currentModelInfo . contextLength ;
}
2023-12-16 22:58:15 +00:00
}
2024-07-08 21:01:30 +00:00
onEditingFinished: {
var val = parseInt ( text )
if ( isNaN ( val ) ) {
text = root . currentModelInfo . contextLength
} else {
if ( val < 8 ) {
val = 8
contextLengthField . text = val
} else if ( val > root . currentModelInfo . maxContextLength ) {
val = root . currentModelInfo . maxContextLength
contextLengthField . text = val
}
MySettings . setModelContextLength ( root . currentModelInfo , val )
focus = false
2024-01-31 19:17:44 +00:00
}
2023-12-16 22:58:15 +00:00
}
2024-07-08 21:01:30 +00:00
Accessible.role: Accessible . EditableText
Accessible.name: contextLengthLabel . text
Accessible.description: ToolTip . text
2023-12-16 22:58:15 +00:00
}
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: tempLabel
2024-01-22 19:41:47 +00:00
text: qsTr ( "Temperature" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Randomness of model output. Higher -> more variation." )
2023-12-16 22:58:15 +00:00
Layout.row: 1
Layout.column: 2
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: temperatureField
text: root . currentModelInfo . temperature
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2024-01-22 19:41:47 +00:00
color: theme . textColor
2023-07-01 15:34:21 +00:00
ToolTip.text: qsTr ( "Temperature increases the chances of choosing less likely tokens.\nNOTE: Higher temperature gives more creative but less predictable outputs." )
ToolTip.visible: hovered
2023-12-16 22:58:15 +00:00
Layout.row: 1
Layout.column: 3
2023-07-01 15:34:21 +00:00
validator: DoubleValidator {
locale: "C"
}
Connections {
target: MySettings
function onTemperatureChanged ( ) {
temperatureField . text = root . currentModelInfo . temperature ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
temperatureField . text = root . currentModelInfo . temperature ;
}
}
onEditingFinished: {
var val = parseFloat ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelTemperature ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . temperature
}
}
Accessible.role: Accessible . EditableText
Accessible.name: tempLabel . text
Accessible.description: ToolTip . text
2023-06-30 13:50:09 +00:00
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: topPLabel
2024-06-28 16:57:57 +00:00
text: qsTr ( "Top-P" )
helpText: qsTr ( "Nucleus Sampling factor. Lower -> more predicatable." )
2023-12-16 22:58:15 +00:00
Layout.row: 2
Layout.column: 0
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: topPField
text: root . currentModelInfo . topP
color: theme . textColor
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2024-06-28 16:57:57 +00:00
ToolTip.text: qsTr ( "Only the most likely tokens up to a total probability of top_p can be chosen.\nNOTE: Prevents choosing highly unlikely tokens." )
2023-07-01 15:34:21 +00:00
ToolTip.visible: hovered
2023-12-16 22:58:15 +00:00
Layout.row: 2
Layout.column: 1
2023-07-01 15:34:21 +00:00
validator: DoubleValidator {
locale: "C"
}
Connections {
target: MySettings
function onTopPChanged ( ) {
topPField . text = root . currentModelInfo . topP ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
topPField . text = root . currentModelInfo . topP ;
}
}
onEditingFinished: {
var val = parseFloat ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelTopP ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . topP
}
}
Accessible.role: Accessible . EditableText
Accessible.name: topPLabel . text
Accessible.description: ToolTip . text
}
2024-02-24 22:51:34 +00:00
MySettingsLabel {
2024-03-05 16:31:31 +00:00
id: minPLabel
2024-06-28 16:57:57 +00:00
text: qsTr ( "Min-P" )
helpText: qsTr ( "Minimum token probability. Higher -> more predictable." )
2024-02-24 22:51:34 +00:00
Layout.row: 3
Layout.column: 0
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2024-02-24 22:51:34 +00:00
}
MyTextField {
id: minPField
text: root . currentModelInfo . minP
color: theme . textColor
font.pixelSize: theme . fontSizeLarge
ToolTip.text: qsTr ( "Sets the minimum relative probability for a token to be considered." )
ToolTip.visible: hovered
Layout.row: 3
Layout.column: 1
validator: DoubleValidator {
locale: "C"
}
Connections {
target: MySettings
function onMinPChanged ( ) {
minPField . text = root . currentModelInfo . minP ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
minPField . text = root . currentModelInfo . minP ;
}
}
onEditingFinished: {
var val = parseFloat ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelMinP ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . minP
}
}
Accessible.role: Accessible . EditableText
Accessible.name: minPLabel . text
Accessible.description: ToolTip . text
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: topKLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-06-28 16:57:57 +00:00
text: qsTr ( "Top-K" )
helpText: qsTr ( "Size of selection pool for tokens." )
2023-12-16 22:58:15 +00:00
Layout.row: 2
Layout.column: 2
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: topKField
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2023-07-01 15:34:21 +00:00
text: root . currentModelInfo . topK
color: theme . textColor
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2024-06-28 16:57:57 +00:00
ToolTip.text: qsTr ( "Only the top K most likely tokens will be chosen from." )
2023-07-01 15:34:21 +00:00
ToolTip.visible: hovered
2023-12-16 22:58:15 +00:00
Layout.row: 2
Layout.column: 3
2023-07-01 15:34:21 +00:00
validator: IntValidator {
bottom: 1
}
Connections {
target: MySettings
function onTopKChanged ( ) {
topKField . text = root . currentModelInfo . topK ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
topKField . text = root . currentModelInfo . topK ;
}
}
onEditingFinished: {
var val = parseInt ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelTopK ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . topK
}
}
Accessible.role: Accessible . EditableText
Accessible.name: topKLabel . text
Accessible.description: ToolTip . text
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: maxLengthLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-22 19:41:47 +00:00
text: qsTr ( "Max Length" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Maximum response length, in tokens." )
2023-12-16 22:58:15 +00:00
Layout.row: 0
2023-07-01 15:34:21 +00:00
Layout.column: 2
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: maxLengthField
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2023-07-01 15:34:21 +00:00
text: root . currentModelInfo . maxLength
color: theme . textColor
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2023-12-16 22:58:15 +00:00
Layout.row: 0
2023-07-01 15:34:21 +00:00
Layout.column: 3
validator: IntValidator {
bottom: 1
}
Connections {
target: MySettings
function onMaxLengthChanged ( ) {
maxLengthField . text = root . currentModelInfo . maxLength ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
maxLengthField . text = root . currentModelInfo . maxLength ;
}
}
onEditingFinished: {
var val = parseInt ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelMaxLength ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . maxLength
}
}
Accessible.role: Accessible . EditableText
Accessible.name: maxLengthLabel . text
Accessible.description: ToolTip . text
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: batchSizeLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-22 19:41:47 +00:00
text: qsTr ( "Prompt Batch Size" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "The batch size used for prompt processing." )
2023-12-16 22:58:15 +00:00
Layout.row: 1
2023-07-01 15:34:21 +00:00
Layout.column: 0
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: batchSizeField
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2023-07-01 15:34:21 +00:00
text: root . currentModelInfo . promptBatchSize
color: theme . textColor
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2024-06-28 16:57:57 +00:00
ToolTip.text: qsTr ( "Amount of prompt tokens to process at once.\nNOTE: Higher values can speed up reading prompts but will use more RAM." )
2023-07-01 15:34:21 +00:00
ToolTip.visible: hovered
2023-12-16 22:58:15 +00:00
Layout.row: 1
2023-07-01 15:34:21 +00:00
Layout.column: 1
validator: IntValidator {
bottom: 1
}
Connections {
target: MySettings
function onPromptBatchSizeChanged ( ) {
batchSizeField . text = root . currentModelInfo . promptBatchSize ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
batchSizeField . text = root . currentModelInfo . promptBatchSize ;
}
}
onEditingFinished: {
var val = parseInt ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelPromptBatchSize ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . promptBatchSize
}
}
Accessible.role: Accessible . EditableText
Accessible.name: batchSizeLabel . text
Accessible.description: ToolTip . text
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: repeatPenaltyLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-22 19:41:47 +00:00
text: qsTr ( "Repeat Penalty" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Repetition penalty factor. Set to 1 to disable." )
2024-02-24 22:51:34 +00:00
Layout.row: 4
Layout.column: 2
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: repeatPenaltyField
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2023-07-01 15:34:21 +00:00
text: root . currentModelInfo . repeatPenalty
color: theme . textColor
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2024-02-24 22:51:34 +00:00
Layout.row: 4
Layout.column: 3
2023-07-01 15:34:21 +00:00
validator: DoubleValidator {
locale: "C"
}
Connections {
target: MySettings
function onRepeatPenaltyChanged ( ) {
repeatPenaltyField . text = root . currentModelInfo . repeatPenalty ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
repeatPenaltyField . text = root . currentModelInfo . repeatPenalty ;
}
}
onEditingFinished: {
var val = parseFloat ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelRepeatPenalty ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . repeatPenalty
}
}
Accessible.role: Accessible . EditableText
Accessible.name: repeatPenaltyLabel . text
Accessible.description: ToolTip . text
}
2024-01-22 19:41:47 +00:00
MySettingsLabel {
2023-07-01 15:34:21 +00:00
id: repeatPenaltyTokensLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-22 19:41:47 +00:00
text: qsTr ( "Repeat Penalty Tokens" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Number of previous tokens used for penalty." )
2023-07-01 15:34:21 +00:00
Layout.row: 3
2023-12-16 22:58:15 +00:00
Layout.column: 2
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2023-07-01 15:34:21 +00:00
}
MyTextField {
id: repeatPenaltyTokenField
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2023-07-01 15:34:21 +00:00
text: root . currentModelInfo . repeatPenaltyTokens
color: theme . textColor
2023-08-07 17:54:13 +00:00
font.pixelSize: theme . fontSizeLarge
2023-07-01 15:34:21 +00:00
Layout.row: 3
2023-12-16 22:58:15 +00:00
Layout.column: 3
2023-07-01 15:34:21 +00:00
validator: IntValidator {
bottom: 1
}
Connections {
target: MySettings
function onRepeatPenaltyTokensChanged ( ) {
repeatPenaltyTokenField . text = root . currentModelInfo . repeatPenaltyTokens ;
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
repeatPenaltyTokenField . text = root . currentModelInfo . repeatPenaltyTokens ;
}
}
onEditingFinished: {
var val = parseInt ( text )
if ( ! isNaN ( val ) ) {
MySettings . setModelRepeatPenaltyTokens ( root . currentModelInfo , val )
focus = false
} else {
text = root . currentModelInfo . repeatPenaltyTokens
}
}
Accessible.role: Accessible . EditableText
Accessible.name: repeatPenaltyTokensLabel . text
Accessible.description: ToolTip . text
}
2024-01-31 19:17:44 +00:00
MySettingsLabel {
id: gpuLayersLabel
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-31 19:17:44 +00:00
text: qsTr ( "GPU Layers" )
2024-06-28 16:57:57 +00:00
helpText: qsTr ( "Number of model layers to load into VRAM." )
2024-01-31 19:17:44 +00:00
Layout.row: 4
Layout.column: 0
2024-07-08 21:01:30 +00:00
Layout.maximumWidth: 300 * theme . fontScale
2024-01-31 19:17:44 +00:00
}
MyTextField {
id: gpuLayersField
2024-02-22 17:51:44 +00:00
visible: ! root . currentModelInfo . isOnline
2024-01-31 19:17:44 +00:00
text: root . currentModelInfo . gpuLayers
font.pixelSize: theme . fontSizeLarge
color: theme . textColor
2024-06-28 16:57:57 +00:00
ToolTip.text: qsTr ( "How many model layers to load into VRAM. Decrease this if GPT4All runs out of VRAM while loading this model.\nLower values increase CPU load and RAM usage, and make inference slower.\nNOTE: Does not take effect until you reload the model." )
2024-01-31 19:17:44 +00:00
ToolTip.visible: hovered
Layout.row: 4
Layout.column: 1
Connections {
target: MySettings
function onGpuLayersChanged ( ) {
gpuLayersField . text = root . currentModelInfo . gpuLayers
}
}
Connections {
target: root
function onCurrentModelInfoChanged ( ) {
2024-02-19 15:37:03 +00:00
if ( root . currentModelInfo . gpuLayers === 100 ) {
2024-01-31 19:17:44 +00:00
gpuLayersField . text = root . currentModelInfo . maxGpuLayers
} else {
gpuLayersField . text = root . currentModelInfo . gpuLayers
}
}
}
onEditingFinished: {
var val = parseInt ( text )
if ( isNaN ( val ) ) {
gpuLayersField . text = root . currentModelInfo . gpuLayers
} else {
if ( val < 1 ) {
val = 1
gpuLayersField . text = val
} else if ( val > root . currentModelInfo . maxGpuLayers ) {
val = root . currentModelInfo . maxGpuLayers
gpuLayersField . text = val
}
MySettings . setModelGpuLayers ( root . currentModelInfo , val )
focus = false
}
}
Accessible.role: Accessible . EditableText
Accessible.name: gpuLayersLabel . text
Accessible.description: ToolTip . text
}
2023-07-01 15:34:21 +00:00
}
Rectangle {
Layout.row: 12
Layout.column: 0
Layout.columnSpan: 2
Layout.topMargin: 15
Layout.fillWidth: true
2024-06-27 11:16:11 +00:00
height: 1
2024-06-24 22:49:23 +00:00
color: theme . settingsDivider
2023-06-30 13:50:09 +00:00
}
}
2023-08-07 17:54:13 +00:00
}