improve python backend startup speed

This commit is contained in:
josc146 2023-07-29 19:18:01 +08:00
parent dbb8374d89
commit 719090cc8c

View File

@ -6,7 +6,6 @@ from pydantic import BaseModel
from utils.rwkv import * from utils.rwkv import *
from utils.torch import * from utils.torch import *
import global_var import global_var
import GPUtil
router = APIRouter() router = APIRouter()
@ -112,6 +111,8 @@ def update_config(body: ModelConfigBody):
@router.get("/status", tags=["Configs"]) @router.get("/status", tags=["Configs"])
def status(): def status():
import GPUtil
gpus = GPUtil.getGPUs() gpus = GPUtil.getGPUs()
if len(gpus) == 0: if len(gpus) == 0:
device_name = "CPU" device_name = "CPU"