From d2284070fc52cb4792f891d68540107446d38547 Mon Sep 17 00:00:00 2001 From: NamH Date: Fri, 21 Jun 2024 14:27:16 +0700 Subject: [PATCH] fix: disable flash_attn if vulkan is enabled (#3080) Signed-off-by: James --- web/hooks/useActiveModel.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/hooks/useActiveModel.ts b/web/hooks/useActiveModel.ts index ce182483e..9768ac4c4 100644 --- a/web/hooks/useActiveModel.ts +++ b/web/hooks/useActiveModel.ts @@ -7,6 +7,7 @@ import { toaster } from '@/containers/Toast' import { LAST_USED_MODEL_ID } from './useRecommendedModel' +import { vulkanEnabledAtom } from '@/helpers/atoms/AppConfig.atom' import { downloadedModelsAtom } from '@/helpers/atoms/Model.atom' import { activeThreadAtom } from '@/helpers/atoms/Thread.atom' @@ -34,6 +35,7 @@ export function useActiveModel() { const downloadedModels = useAtomValue(downloadedModelsAtom) const setLoadModelError = useSetAtom(loadModelErrorAtom) const [pendingModelLoad, setPendingModelLoad] = useAtom(pendingModelLoadAtom) + const isVulkanEnabled = useAtomValue(vulkanEnabledAtom) const downloadedModelsRef = useRef([]) @@ -90,6 +92,11 @@ export function useActiveModel() { } } + if (isVulkanEnabled) { + // @ts-expect-error flash_attn is newly added and will be migrate to cortex in the future + model.settings['flash_attn'] = false + } + localStorage.setItem(LAST_USED_MODEL_ID, model.id) const engine = EngineManager.instance().get(model.engine) return engine