Helloyunho e86cd7e661
feat: add a simple way to convert Hugging Face model to GGUF (#1972)
* chore: add react developer tools to electron

* feat: add small convert modal

* feat: separate modals and add hugging face extension

* feat: fully implement hugging face converter

* fix: forgot to uncomment this...

* fix: typo

* feat: try hf-to-gguf script first and then use convert.py

HF-to-GGUF has support for some unusual models
maybe using convert.py first would be better but we can change the usage order later

* fix: pre-install directory changed

* fix: sometimes exit code is undefined

* chore: download additional files for qwen

* fix: event handling changed

* chore: add one more necessary package

* feat: download gguf-py from llama.cpp

* fix: cannot interpret wildcards on GNU tar

Co-authored-by: hiento09 <136591877+hiento09@users.noreply.github.com>

---------

Co-authored-by: hiento09 <136591877+hiento09@users.noreply.github.com>
2024-02-26 10:57:53 +07:00

46 lines
1.2 KiB
TypeScript

import { Button, Input } from '@janhq/uikit'
import { useSetAtom, useAtomValue } from 'jotai'
import { useGetHFRepoData } from '@/hooks/useGetHFRepoData'
import { repoIDAtom, loadingAtom } from '@/helpers/atoms/HFConverter.atom'
export const HuggingFaceSearchModal = () => {
const setRepoID = useSetAtom(repoIDAtom)
const loading = useAtomValue(loadingAtom)
const getRepoData = useGetHFRepoData()
const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
e.preventDefault()
getRepoData()
}
}
return (
<>
<div className="flex flex-col items-center justify-center gap-1">
<p className="text-2xl font-bold">Hugging Face Convertor</p>
<p className="text-gray-500">Type the repository id below</p>
</div>
<Input
placeholder="e.g. username/repo-name"
className="bg-white dark:bg-background"
onChange={(e) => {
setRepoID(e.target.value)
}}
onKeyDown={onKeyDown}
/>
<Button
onClick={getRepoData}
className="w-full"
loading={loading}
themes={loading ? 'ghost' : 'primary'}
>
{loading ? '' : 'OK'}
</Button>
</>
)
}