diff --git a/README.md b/README.md index 7ac9bf5d..830ff197 100644 --- a/README.md +++ b/README.md @@ -175,11 +175,18 @@ The documentation covers: ## Testing -kvcached can be enabled by setting the following environmental variables: +kvcached can be enabled by setting `ENABLE_KVCACHED` either in the shell: ```bash export ENABLE_KVCACHED=true -export KVCACHED_AUTOPATCH=1 +``` + +or from Python script (before `import vllm` / `import sglang`): + +```python +import os +os.environ["ENABLE_KVCACHED"] = "true" +from kvcached import autopatch # required when setting from Python; ``` If you are using the engine-specific dockers, you can test kvcached by running the original engines' benchmark scripts. For example: diff --git a/kvcached/integration/sglang/autopatch.py b/kvcached/integration/sglang/autopatch.py index 89aee9c4..abc7d23f 100644 --- a/kvcached/integration/sglang/autopatch.py +++ b/kvcached/integration/sglang/autopatch.py @@ -23,7 +23,10 @@ def _env_enabled() -> bool: - return os.getenv("KVCACHED_AUTOPATCH", "false").lower() in ("true", "1") + return ( + os.getenv("ENABLE_KVCACHED", "false").lower() in ("true", "1") + or os.getenv("KVCACHED_AUTOPATCH", "false").lower() in ("true", "1") + ) @when_imported("sglang") diff --git a/kvcached/integration/vllm/autopatch.py b/kvcached/integration/vllm/autopatch.py index ea31c3a4..ac10693b 100644 --- a/kvcached/integration/vllm/autopatch.py +++ b/kvcached/integration/vllm/autopatch.py @@ -24,7 +24,10 @@ def _env_enabled() -> bool: - return os.getenv("KVCACHED_AUTOPATCH", "false").lower() in ("true", "1") + return ( + os.getenv("ENABLE_KVCACHED", "false").lower() in ("true", "1") + or os.getenv("KVCACHED_AUTOPATCH", "false").lower() in ("true", "1") + ) @when_imported("vllm")