[Bugfix] Lazy import diskcache to avoid sqlite3/libstdc++ ImportError at startup (#38649)

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>
This commit is contained in:
Jeffrey Wang
2026-03-31 22:31:20 -07:00
committed by GitHub
parent ef53395e2c
commit 2d725b89c5

View File

@@ -12,7 +12,6 @@ import numpy as np
import regex as re
import torch
from cachetools import LRUCache
from diskcache import Cache
import vllm.envs as envs
from vllm.logger import init_logger
@@ -181,6 +180,8 @@ def get_outlines_cache():
cache_dir = get_outlines_cache_path()
if envs.VLLM_V1_USE_OUTLINES_CACHE:
from diskcache import Cache
logger.warning(
"Enabling outlines cache. This is an unbounded on-disk "
"cache. It may consume a lot of disk space and should "