From 2ea063cea9fa722e08306288a9c132f702bdcd6e Mon Sep 17 00:00:00 2001 From: kingbri Date: Thu, 1 Feb 2024 12:40:24 -0500 Subject: [PATCH] Tree: Require exllamav2 version for startup Exllamav2 is currently supported on all GPUs and versions. Therefore, it should be expected that users use the latest version of exllamav2 to get the latest features. Doing this helps reduce checks that don't really serve any purpose. Signed-off-by: kingbri --- main.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/main.py b/main.py index a0f2b39..921ebbe 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,8 @@ from fastapi import FastAPI, Depends, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import StreamingResponse from functools import partial +from packaging import version +from importlib.metadata import version as package_version from progress.bar import IncrementalBar import common.gen_logging as gen_logging @@ -578,6 +580,26 @@ def entrypoint(args: Optional[dict] = None): """Entry function for program startup""" global MODEL_CONTAINER + # Check exllamav2 version and give a descriptive error if it's too old + required_exl_version = "0.0.12" + current_exl_version = package_version("exllamav2").split("+")[0] + + if version.parse(current_exl_version) < version.parse(required_exl_version): + raise SystemExit( + f"TabbyAPI requires ExLlamaV2 {required_exl_version} " + f"or greater. Your current version is {current_exl_version}.\n" + "Please upgrade your environment by running a start script " + "(start.bat or start.sh)\n\n" + "Or you can manually run a requirements update " + "using the following command:\n\n" + "For CUDA 12.1:\n" + "pip install --upgrade -r requirements.txt\n\n" + "For CUDA 11.8:\n" + "pip install --upgrade -r requirements-cu118.txt\n\n" + "For ROCm:\n" + "pip install --upgrade -r requirements-amd.txt\n\n" + ) + # Load from YAML config read_config_from_file(pathlib.Path("config.yml"))