Skip to content

Commit

Permalink
fix: disable flash_attn if vulkan is enabled (janhq#3080)
Browse files Browse the repository at this point in the history
Signed-off-by: James <[email protected]>
  • Loading branch information
namchuai authored Jun 21, 2024
1 parent a91fe5c commit d228407
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/hooks/useActiveModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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<Model[]>([])

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d228407

Please sign in to comment.