diff --git a/backend-python/requirements.txt b/backend-python/requirements.txt index c241a89..30857ab 100644 Binary files a/backend-python/requirements.txt and b/backend-python/requirements.txt differ diff --git a/backend-python/requirements_versions.txt b/backend-python/requirements_versions.txt index 64bf5c5..6d94b05 100644 Binary files a/backend-python/requirements_versions.txt and b/backend-python/requirements_versions.txt differ diff --git a/backend-python/routes/config.py b/backend-python/routes/config.py index 41742ea..8218541 100644 --- a/backend-python/routes/config.py +++ b/backend-python/routes/config.py @@ -6,6 +6,7 @@ from langchain.llms import RWKV from utils.rwkv import * from utils.torch import * import global_var +import GPUtil router = APIRouter() @@ -25,8 +26,8 @@ def switch_model(body: SwitchModelBody, response: Response): global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline) global_var.set(global_var.Model, None) torch_gc() - - os.environ["RWKV_CUDA_ON"] = '1' if body.customCuda else '0' + + os.environ["RWKV_CUDA_ON"] = "1" if body.customCuda else "0" global_var.set(global_var.Model_Status, global_var.ModelStatus.Loading) try: @@ -66,4 +67,13 @@ def update_config(body: ModelConfigBody): @router.get("/status") def status(): - return {"status": global_var.get(global_var.Model_Status)} + gpus = GPUtil.getGPUs() + if len(gpus) == 0: + device_name = "CPU" + else: + device_name = gpus[0].name + return { + "status": global_var.get(global_var.Model_Status), + "pid": os.getpid(), + "device_name": device_name, + } diff --git a/frontend/src/utils/index.tsx b/frontend/src/utils/index.tsx index 4b1629e..c4cca0b 100644 --- a/frontend/src/utils/index.tsx +++ b/frontend/src/utils/index.tsx @@ -189,9 +189,9 @@ export function forceDownloadProgramFiles() { }); } -export function deletePythonProgramFiles() { +export function deleteDynamicProgramFiles() { manifest.programFiles.forEach(({ path }) => { - if (path.endsWith('.py') && !path.includes('get-pip.py')) + if ((path.endsWith('.py') && !path.includes('get-pip.py')) || path.includes('requirements')) DeleteFile(path); }); } @@ -223,7 +223,7 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) { `https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe` : `https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`; toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => { - deletePythonProgramFiles(); + deleteDynamicProgramFiles(); setTimeout(() => { UpdateApp(updateUrl).catch((e) => { toast(t('Update Error, Please restart this program') + ' - ' + e.message || e, {