TensorRT-LLMs/tests/utils/llm_data.py
石晓伟 8f91cff22e
TensorRT-LLM Release 0.15.0 (#2529)
Co-authored-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
2024-12-04 13:44:56 +08:00

24 lines
654 B
Python

import os
from pathlib import Path
from typing import Optional
def llm_models_root(check=False) -> Optional[Path]:
root = Path("/home/scratch.trt_llm_data/llm-models/")
if "LLM_MODELS_ROOT" in os.environ:
root = Path(os.environ.get("LLM_MODELS_ROOT"))
if not root.exists():
root = Path("/scratch.trt_llm_data/llm-models/")
if check:
assert root.exists(), \
"You shall set LLM_MODELS_ROOT env or be able to access /home/scratch.trt_llm_data to run this test"
return root if root.exists() else None
def llm_datasets_root() -> str:
return os.path.join(llm_models_root(check=True), "datasets")