Spaces:
Running on L40S
Running on L40S
root commited on
Commit ·
4d53bbc
1
Parent(s): c89b5ea
fix bug
Browse files5 unmodified lines6789101140 unmodified lines52535455565758596061625 unmodified linesimport tempfilefrom datetime import datetimeimport gradio as grimport torchimport torchaudio40 unmodified linesself.tokenizer = build_tokenizer(args)self.text_offset = len(self.tokenizer.tokenizer.get_vocab())self.max_tokens = 8192self.llm = LLM(model=model_path,trust_remote_code=True,max_model_len=self.max_tokens,dtype="bfloat16",)def run(self, audios):5 unmodified lines6789101112131415161718192021222324252640 unmodified lines67686970717273747576777879808182838485868788895 unmodified linesimport tempfilefrom datetime import datetime# ---------------------------------------------------------------------------# vLLM env tweaks – set BEFORE `import vllm` so they actually take effect.## Why these are here:# * VLLM_USE_V1=0 -> stay on the single-process v0 engine. The default v1# engine forks an EngineCore subprocess which roughly doubles host RAM# because the 7B weights get loaded twice. That is the most common cause# of `exit 137 / OOMKilled` on hosts with limited RAM (HF Spaces etc.),# even when the GPU has plenty of free VRAM (L40s 48GB here).# * VLLM_WORKER_MULTIPROC_METHOD=fork -> if v1 is ever re-enabled, prefer# fork over spawn so weights are CoW-shared instead of reloaded.# ---------------------------------------------------------------------------os.environ.setdefault("VLLM_USE_V1", "0")os.environ.setdefault("VLLM_WORKER_MULTIPROC_METHOD", "fork")import gradio as grimport torchimport torchaudio40 unmodified linesself.tokenizer = build_tokenizer(args)self.text_offset = len(self.tokenizer.tokenizer.get_vocab())self.max_tokens = 8192# NOTE on memory:# - swap_space=0 : disable the default 4 GiB CPU KV swap pool# (saves ~4 GB host RAM; GPU has plenty of# VRAM so we never need to swap).# - enforce_eager=True : skip CUDA-graph capture, which otherwise# allocates several GB of pinned/host# workspace at startup.# - gpu_memory_utilization stays at default (0.9) — we have a 48GB# L40s, the OOM is on host RAM, not VRAM.self.llm = LLM(model=model_path,trust_remote_code=True,max_model_len=self.max_tokens,dtype="bfloat16",swap_space=0,enforce_eager=True,disable_log_stats=True,)def run(self, audios):
app.py+27