-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from SkywardAI/improve
add wllama settings
- Loading branch information
Showing
9 changed files
with
148 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { useEffect, useState } from "react"; | ||
import SettingSection from "./SettingSection"; | ||
import TrueFalseComponent from "./components/TrueFalseComponent"; | ||
import ScrollBarComponent from "./components/ScrollBarComponent"; | ||
import { getPlatformSettings, updatePlatformSettings } from "../../utils/general_settings"; | ||
import { loadModel, loadModelSamplingSettings } from "../../utils/workers/worker"; | ||
|
||
export default function WllamaSettings({ trigger, enabled }) { | ||
|
||
const [ threads, setThreads ] = useState(1); | ||
const [ batch_size, setBatchSize ] = useState(256); | ||
const [ context_length, setContextLength ] = useState(4096); | ||
const [ continue_conv, setContinueConversation ] = useState(false); | ||
|
||
function saveSettings() { | ||
updatePlatformSettings({ | ||
wllama_threads: threads, | ||
wllama_batch_size: batch_size, | ||
wllama_context_length: context_length, | ||
wllama_continue_conv: continue_conv | ||
}) | ||
|
||
if(enabled) { | ||
loadModelSamplingSettings(); | ||
loadModel('completion'); | ||
} | ||
} | ||
|
||
useEffect(()=>{ | ||
trigger && saveSettings(); | ||
// eslint-disable-next-line | ||
}, [trigger]) | ||
|
||
useEffect(()=>{ | ||
const { | ||
wllama_threads, | ||
wllama_batch_size, | ||
wllama_context_length, | ||
wllama_continue_conv | ||
} = getPlatformSettings(); | ||
|
||
setThreads(wllama_threads) | ||
setBatchSize(wllama_batch_size) | ||
setContextLength(wllama_context_length) | ||
setContinueConversation(wllama_continue_conv) | ||
|
||
}, []) | ||
|
||
return ( | ||
<SettingSection title={'Local Model Settings'}> | ||
<ScrollBarComponent | ||
title={"Set Threads to use"} | ||
value={threads} cb={setThreads} | ||
description={'Please set how many threads you want to use, max is your CPU cores.'} | ||
min={1} max={navigator.hardwareConcurrency} | ||
/> | ||
<TrueFalseComponent | ||
title={"Enable Continue Conversation"} | ||
description={"Open to continue conversation instead treate any question as a new conversation. This can cause the response speed becomes extreamly slow."} | ||
value={continue_conv} cb={setContinueConversation} | ||
/> | ||
<ScrollBarComponent | ||
title={"Set Batch Size"} | ||
value={batch_size} cb={setBatchSize} | ||
description={'Adjust batch size to balance the performance and cost.'} | ||
min={1} max={512} | ||
/> | ||
<ScrollBarComponent | ||
title={"Set Context Length"} | ||
value={context_length} cb={setContextLength} | ||
description={'Adjust the max tokens of a conversation, over this size would reset the conversation.'} | ||
min={1024} max={4096} | ||
/> | ||
</SettingSection> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters