Skip to content

Commit 43195d6

Browse files
mgoindbogunowicz
authored and
dbogunowicz
committed
Move model filelocks from /tmp/ to ~/.cache/vllm/locks/ dir (vllm-project#3241)
1 parent 02b01a8 commit 43195d6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vllm/model_executor/weight_utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
logger = init_logger(__name__)
2222

23+
_xdg_cache_home = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache'))
24+
_vllm_filelocks_path = os.path.join(_xdg_cache_home, 'vllm/locks/')
25+
2326

2427
class Disabledtqdm(tqdm):
2528

@@ -28,7 +31,8 @@ def __init__(self, *args, **kwargs):
2831

2932

3033
def get_lock(model_name_or_path: str, cache_dir: Optional[str] = None):
31-
lock_dir = cache_dir if cache_dir is not None else "/tmp"
34+
lock_dir = cache_dir if cache_dir is not None else _vllm_filelocks_path
35+
os.makedirs(os.path.dirname(lock_dir), exist_ok=True)
3236
lock_file_name = model_name_or_path.replace("/", "-") + ".lock"
3337
lock = filelock.FileLock(os.path.join(lock_dir, lock_file_name))
3438
return lock

0 commit comments

Comments
 (0)