[Update/Chore] Config Page: Add 'Whisper Compute Type' Selection.
UI: Rename 'Whisper compute device' to 'Transcription compute device'.
This commit is contained in:
@@ -201,7 +201,8 @@ const TranscriptionEngine_Container = () => {
|
||||
<SectionLabelComponent label={t("config_page.transcription.section_label_transcription_engines")} />
|
||||
<TranscriptionEngine_Box />
|
||||
<WhisperWeightType_Box />
|
||||
<WhisperComputeDevice_Box />
|
||||
<WhisperComputeType_Box />
|
||||
<TranscriptionComputeDevice_Box />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -274,46 +275,70 @@ const WhisperWeightType_Box = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const WhisperComputeType_Box = () => {
|
||||
const { t } = useI18n();
|
||||
const { currentSelectableWhisperComputeTypeList } = useTranscription();
|
||||
const { currentSelectedWhisperComputeType, setSelectedWhisperComputeType } = useTranscription();
|
||||
|
||||
const selectFunction = (selected_data) => {
|
||||
setSelectedWhisperComputeType(selected_data.selected_id);
|
||||
};
|
||||
|
||||
const whisper_compute_type_label = t("config_page.transcription.whisper_compute_type.label", {
|
||||
whisper: "Whisper"
|
||||
});
|
||||
|
||||
return (
|
||||
<DropdownMenuContainer
|
||||
dropdown_id="whisper_compute_type"
|
||||
label={whisper_compute_type_label}
|
||||
selected_id={currentSelectedWhisperComputeType.data}
|
||||
list={currentSelectableWhisperComputeTypeList.data}
|
||||
selectFunction={selectFunction}
|
||||
state={currentSelectedWhisperComputeType.state}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
// Duplicate
|
||||
import { useComputeMode } from "@logics_common";
|
||||
const WhisperComputeDevice_Box = () => {
|
||||
const TranscriptionComputeDevice_Box = () => {
|
||||
const { t } = useI18n();
|
||||
const { currentSelectedWhisperComputeDevice, setSelectedWhisperComputeDevice } = useTranscription();
|
||||
const { currentSelectableWhisperComputeDeviceList } = useTranscription();
|
||||
const { currentSelectedTranscriptionComputeDevice, setSelectedTranscriptionComputeDevice } = useTranscription();
|
||||
const { currentSelectableTranscriptionComputeDeviceList } = useTranscription();
|
||||
|
||||
const selectFunction = (selected_data) => {
|
||||
const target_obj = currentSelectableWhisperComputeDeviceList.data[selected_data.selected_id];
|
||||
setSelectedWhisperComputeDevice(target_obj);
|
||||
const target_obj = currentSelectableTranscriptionComputeDeviceList.data[selected_data.selected_id];
|
||||
setSelectedTranscriptionComputeDevice(target_obj);
|
||||
};
|
||||
|
||||
const list_for_ui = transformDeviceArray(currentSelectableWhisperComputeDeviceList.data);
|
||||
const list_for_ui = transformDeviceArray(currentSelectableTranscriptionComputeDeviceList.data);
|
||||
|
||||
const target_index = findKeyByDeviceValue(currentSelectableWhisperComputeDeviceList.data, currentSelectedWhisperComputeDevice.data);
|
||||
const target_index = findKeyByDeviceValue(currentSelectableTranscriptionComputeDeviceList.data, currentSelectedTranscriptionComputeDevice.data);
|
||||
|
||||
|
||||
const { currentComputeMode } = useComputeMode();
|
||||
if (currentComputeMode.data === "cpu") {
|
||||
return (
|
||||
<ComputeDeviceContainer
|
||||
label={t("config_page.transcription.whisper_compute_device.label")}
|
||||
label={t("config_page.transcription.transcription_compute_device.label")}
|
||||
selected_id={target_index}
|
||||
list={list_for_ui}
|
||||
selectFunction={selectFunction}
|
||||
state={currentSelectedWhisperComputeDevice.state}
|
||||
state={currentSelectedTranscriptionComputeDevice.state}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenuContainer
|
||||
dropdown_id="whisper_compute_device"
|
||||
label={t("config_page.transcription.whisper_compute_device.label")}
|
||||
// desc={t("config_page.transcription.whisper_compute_device.label")}
|
||||
dropdown_id="transcription_compute_device"
|
||||
label={t("config_page.transcription.transcription_compute_device.label")}
|
||||
// desc={t("config_page.transcription.transcription_compute_device.label")}
|
||||
selected_id={target_index}
|
||||
list={list_for_ui}
|
||||
selectFunction={selectFunction}
|
||||
state={currentSelectedWhisperComputeDevice.state}
|
||||
state={currentSelectedTranscriptionComputeDevice.state}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,12 +8,14 @@ import {
|
||||
useStore_SpeakerPhraseTimeout,
|
||||
useStore_SpeakerRecordTimeout,
|
||||
|
||||
useStore_SelectableWhisperComputeDeviceList,
|
||||
useStore_SelectableTranscriptionComputeDeviceList,
|
||||
useStore_SelectedTranscriptionEngine,
|
||||
useStore_SelectedWhisperComputeDevice,
|
||||
useStore_SelectedWhisperWeightType,
|
||||
useStore_SelectedTranscriptionComputeDevice,
|
||||
|
||||
useStore_WhisperWeightTypeStatus,
|
||||
useStore_SelectedWhisperWeightType,
|
||||
useStore_SelectedWhisperComputeType,
|
||||
useStore_SelectableWhisperComputeTypeList,
|
||||
|
||||
useStore_MicAvgLogprob,
|
||||
useStore_MicNoSpeechProb,
|
||||
@@ -21,7 +23,7 @@ import {
|
||||
useStore_SpeakerNoSpeechProb,
|
||||
} from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { transformToIndexedArray } from "@utils";
|
||||
import { transformToIndexedArray, arrayToObject } from "@utils";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
|
||||
export const useTranscription = () => {
|
||||
@@ -41,10 +43,16 @@ export const useTranscription = () => {
|
||||
|
||||
// Transcription Engines
|
||||
const { currentSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, pendingSelectedTranscriptionEngine } = useStore_SelectedTranscriptionEngine();
|
||||
|
||||
const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus();
|
||||
const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType();
|
||||
const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList();
|
||||
const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice();
|
||||
|
||||
|
||||
const { currentSelectableWhisperComputeTypeList, updateSelectableWhisperComputeTypeList, pendingSelectableWhisperComputeTypeList } = useStore_SelectableWhisperComputeTypeList();
|
||||
const { currentSelectedWhisperComputeType, updateSelectedWhisperComputeType, pendingSelectedWhisperComputeType } = useStore_SelectedWhisperComputeType();
|
||||
|
||||
const { currentSelectableTranscriptionComputeDeviceList, updateSelectableTranscriptionComputeDeviceList, pendingSelectableTranscriptionComputeDeviceList } = useStore_SelectableTranscriptionComputeDeviceList();
|
||||
const { currentSelectedTranscriptionComputeDevice, updateSelectedTranscriptionComputeDevice, pendingSelectedTranscriptionComputeDevice } = useStore_SelectedTranscriptionComputeDevice();
|
||||
|
||||
// Advanced Settings
|
||||
const { currentMicAvgLogprob, updateMicAvgLogprob, pendingMicAvgLogprob } = useStore_MicAvgLogprob();
|
||||
@@ -246,6 +254,33 @@ export const useTranscription = () => {
|
||||
asyncStdoutToPython("/run/download_whisper_weight", weight_type);
|
||||
};
|
||||
|
||||
|
||||
const getSelectableWhisperComputeTypeList = () => {
|
||||
pendingSelectableWhisperComputeTypeList();
|
||||
asyncStdoutToPython("/get/data/whisper_compute_type_list");
|
||||
};
|
||||
|
||||
const updateSelectableWhisperComputeTypeList_FromBackend = (payload) => {
|
||||
updateSelectableWhisperComputeTypeList(arrayToObject(payload));
|
||||
};
|
||||
|
||||
|
||||
const getSelectedWhisperComputeType = () => {
|
||||
pendingSelectedWhisperComputeType();
|
||||
asyncStdoutToPython("/get/data/whisper_compute_type");
|
||||
};
|
||||
|
||||
const setSelectedWhisperComputeType = (selected_whisper_compute_type) => {
|
||||
pendingSelectedWhisperComputeType();
|
||||
asyncStdoutToPython("/set/data/whisper_compute_type", selected_whisper_compute_type);
|
||||
};
|
||||
|
||||
const setSuccessSelectedWhisperComputeType = (selected_whisper_compute_type) => {
|
||||
updateSelectedWhisperComputeType(selected_whisper_compute_type);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
|
||||
// Transcription Engines (Selected Weight Type)
|
||||
const getSelectedWhisperWeightType = () => {
|
||||
pendingSelectedWhisperWeightType();
|
||||
@@ -263,28 +298,28 @@ export const useTranscription = () => {
|
||||
};
|
||||
|
||||
// Transcription Engines (Compute Device List)
|
||||
const getSelectableWhisperComputeDeviceList = () => {
|
||||
pendingSelectableWhisperComputeDeviceList();
|
||||
const getSelectableTranscriptionComputeDeviceList = () => {
|
||||
pendingSelectableTranscriptionComputeDeviceList();
|
||||
asyncStdoutToPython("/get/data/transcription_compute_device_list");
|
||||
};
|
||||
|
||||
const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => {
|
||||
updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload));
|
||||
const updateSelectableTranscriptionComputeDeviceList_FromBackend = (payload) => {
|
||||
updateSelectableTranscriptionComputeDeviceList(transformToIndexedArray(payload));
|
||||
};
|
||||
|
||||
// Transcription Engines (Selected Compute Device)
|
||||
const getSelectedWhisperComputeDevice = () => {
|
||||
pendingSelectedWhisperComputeDevice();
|
||||
const getSelectedTranscriptionComputeDevice = () => {
|
||||
pendingSelectedTranscriptionComputeDevice();
|
||||
asyncStdoutToPython("/get/data/selected_transcription_compute_device");
|
||||
};
|
||||
|
||||
const setSelectedWhisperComputeDevice = (selected_transcription_compute_device) => {
|
||||
pendingSelectedWhisperComputeDevice();
|
||||
const setSelectedTranscriptionComputeDevice = (selected_transcription_compute_device) => {
|
||||
pendingSelectedTranscriptionComputeDevice();
|
||||
asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device);
|
||||
};
|
||||
|
||||
const setSuccessSelectedWhisperComputeDevice = (dev) => {
|
||||
updateSelectedWhisperComputeDevice(dev);
|
||||
const setSuccessSelectedTranscriptionComputeDevice = (dev) => {
|
||||
updateSelectedTranscriptionComputeDevice(dev);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
@@ -416,16 +451,29 @@ export const useTranscription = () => {
|
||||
setSelectedWhisperWeightType,
|
||||
setSuccessSelectedWhisperWeightType,
|
||||
|
||||
currentSelectableWhisperComputeDeviceList,
|
||||
getSelectableWhisperComputeDeviceList,
|
||||
updateSelectableWhisperComputeDeviceList,
|
||||
updateSelectableWhisperComputeDeviceList_FromBackend,
|
||||
|
||||
currentSelectedWhisperComputeDevice,
|
||||
getSelectedWhisperComputeDevice,
|
||||
updateSelectedWhisperComputeDevice,
|
||||
setSelectedWhisperComputeDevice,
|
||||
setSuccessSelectedWhisperComputeDevice,
|
||||
currentSelectableWhisperComputeTypeList,
|
||||
getSelectableWhisperComputeTypeList,
|
||||
updateSelectableWhisperComputeTypeList,
|
||||
updateSelectableWhisperComputeTypeList_FromBackend,
|
||||
|
||||
currentSelectedWhisperComputeType,
|
||||
getSelectedWhisperComputeType,
|
||||
updateSelectedWhisperComputeType,
|
||||
setSelectedWhisperComputeType,
|
||||
setSuccessSelectedWhisperComputeType,
|
||||
|
||||
|
||||
currentSelectableTranscriptionComputeDeviceList,
|
||||
getSelectableTranscriptionComputeDeviceList,
|
||||
updateSelectableTranscriptionComputeDeviceList,
|
||||
updateSelectableTranscriptionComputeDeviceList_FromBackend,
|
||||
|
||||
currentSelectedTranscriptionComputeDevice,
|
||||
getSelectedTranscriptionComputeDevice,
|
||||
updateSelectedTranscriptionComputeDevice,
|
||||
setSelectedTranscriptionComputeDevice,
|
||||
setSuccessSelectedTranscriptionComputeDevice,
|
||||
|
||||
// Advanced
|
||||
// Mic Avg Logprob
|
||||
|
||||
@@ -214,18 +214,22 @@ export const ROUTE_META_LIST = [
|
||||
{ endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" },
|
||||
{ endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" },
|
||||
|
||||
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" },
|
||||
{ endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" },
|
||||
{ endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" },
|
||||
|
||||
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" },
|
||||
{ endpoint: "/get/data/whisper_compute_type_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeTypeList_FromBackend" },
|
||||
{ endpoint: "/get/data/whisper_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeType" },
|
||||
{ endpoint: "/set/data/whisper_compute_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperComputeType" },
|
||||
|
||||
|
||||
{ endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" },
|
||||
{ endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null },
|
||||
{ endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadProgressWhisperWeightTypeStatus" },
|
||||
|
||||
{ endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" },
|
||||
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" },
|
||||
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperComputeDevice" },
|
||||
{ endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableTranscriptionComputeDeviceList_FromBackend" },
|
||||
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeDevice" },
|
||||
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeDevice" },
|
||||
|
||||
// Transcription (Advanced)
|
||||
{ endpoint: "/get/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateMicAvgLogprob" },
|
||||
|
||||
@@ -240,8 +240,12 @@ export const { atomInstance: Atom_SelectedWhisperWeightType, useHook: useStore_S
|
||||
export const { atomInstance: Atom_WhisperWeightTypeStatus, useHook: useStore_WhisperWeightTypeStatus } = createAtomWithHook(whisper_weight_type_status, "WhisperWeightTypeStatus");
|
||||
export const { atomInstance: Atom_SelectedTranscriptionEngine, useHook: useStore_SelectedTranscriptionEngine } = createAtomWithHook(whisper_weight_type_status, "SelectedTranscriptionEngine");
|
||||
|
||||
export const { atomInstance: Atom_SelectableWhisperComputeDeviceList, useHook: useStore_SelectableWhisperComputeDeviceList } = createAtomWithHook({}, "SelectableWhisperComputeDeviceList");
|
||||
export const { atomInstance: Atom_SelectedWhisperComputeDevice, useHook: useStore_SelectedWhisperComputeDevice } = createAtomWithHook("", "SelectedWhisperComputeDevice");
|
||||
export const { atomInstance: Atom_SelectableWhisperComputeTypeList, useHook: useStore_SelectableWhisperComputeTypeList } = createAtomWithHook({}, "SelectableWhisperComputeTypeList");
|
||||
export const { atomInstance: Atom_SelectedWhisperComputeType, useHook: useStore_SelectedWhisperComputeType } = createAtomWithHook("", "SelectedWhisperComputeType");
|
||||
|
||||
|
||||
export const { atomInstance: Atom_SelectableTranscriptionComputeDeviceList, useHook: useStore_SelectableTranscriptionComputeDeviceList } = createAtomWithHook({}, "SelectableTranscriptionComputeDeviceList");
|
||||
export const { atomInstance: Atom_SelectedTranscriptionComputeDevice, useHook: useStore_SelectedTranscriptionComputeDevice } = createAtomWithHook("", "SelectedTranscriptionComputeDevice");
|
||||
|
||||
export const { atomInstance: Atom_MicAvgLogprob, useHook: useStore_MicAvgLogprob } = createAtomWithHook(-0.8, "MicAvgLogprob");
|
||||
export const { atomInstance: Atom_MicNoSpeechProb, useHook: useStore_MicNoSpeechProb } = createAtomWithHook(0.6, "MicNoSpeechProb");
|
||||
|
||||
Reference in New Issue
Block a user