import {Button, CompoundButton, Dropdown, Link, Option, Text} from '@fluentui/react-components';
import React, {FC, ReactElement} from 'react';
import banner from '../assets/images/banner.jpg';
import {
Chat20Regular,
DataUsageSettings20Regular,
DocumentSettings20Regular,
Storage20Regular
} from '@fluentui/react-icons';
import {useNavigate} from 'react-router';
import commonStore, {ModelStatus} from '../stores/commonStore';
import {observer} from 'mobx-react-lite';
import {StartServer} from '../../wailsjs/go/backend_golang/App';
type NavCard = {
label: string;
desc: string;
path: string;
icon: ReactElement;
};
export const navCards: NavCard[] = [
{
label: 'Chat',
desc: 'Go to chat page',
path: '/chat',
icon:
},
{
label: 'Configs',
desc: 'Manage your configs',
path: '/configs',
icon:
},
{
label: 'Models',
desc: 'Manage models',
path: '/models',
icon:
},
{
label: 'Train',
desc: '',
path: '/train',
icon:
}
];
const mainButtonText = {
[ModelStatus.Offline]: 'Run',
[ModelStatus.Starting]: 'Starting',
[ModelStatus.Loading]: 'Loading',
[ModelStatus.Working]: 'Stop'
};
export const Home: FC = observer(() => {
const [selectedConfig, setSelectedConfig] = React.useState('RWKV-3B-4G MEM');
const navigate = useNavigate();
const onClickNavCard = (path: string) => {
navigate({pathname: path});
};
const onClickMainButton = async () => {
if (commonStore.modelStatus === ModelStatus.Offline) {
commonStore.setModelStatus(ModelStatus.Starting);
StartServer('cuda fp16', 'models\\RWKV-4-Raven-1B5-v8-Eng-20230408-ctx4096.pth');
let timeoutCount = 5;
let loading = false;
const intervalId = setInterval(() => {
fetch('http://127.0.0.1:8000')
.then(r => {
if (r.ok && !loading) {
clearInterval(intervalId);
commonStore.setModelStatus(ModelStatus.Loading);
loading = true;
fetch('http://127.0.0.1:8000/update-config', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({})
}).then(async (r) => {
if (r.ok)
commonStore.setModelStatus(ModelStatus.Working);
});
}
}).catch(() => {
if (timeoutCount <= 0) {
clearInterval(intervalId);
commonStore.setModelStatus(ModelStatus.Offline);
}
});
timeoutCount--;
}, 1000);
} else {
commonStore.setModelStatus(ModelStatus.Offline);
fetch('http://127.0.0.1:8000/exit', {method: 'POST'});
}
};
return (
Introduction
RWKV is an RNN with Transformer-level LLM performance, which can also be directly trained like a GPT
transformer (parallelizable). And it's 100% attention-free. You only need the hidden state at position t to
compute the state at position t+1. You can use the "GPT" mode to quickly compute the hidden state for the
"RNN" mode.
So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast
training, "infinite" ctx_len, and free sentence embedding (using the final hidden state).
{navCards.map(({label, path, icon, desc}, index) => (
onClickNavCard(path)}>
{label}
))}
{
if (data.optionValue)
setSelectedConfig(data.optionValue);
}}>
RWKV-3B-4G MEM
Item 2
Item 3
Item 4
{mainButtonText[commonStore.modelStatus]}
Version: 1.0.0
Help
);
});