MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / get_file_lock

Function get_file_lock

tensorrt_llm/llmapi/utils.py:206–216  ·  view source on GitHub ↗
(model_name: str,
                  cache_dir: Optional[str] = None)

Source from the content-addressed store, hash-verified

204
205
206def get_file_lock(model_name: str,
207 cache_dir: Optional[str] = None) -> filelock.FileLock:
208 # Hash the model name to avoid invalid characters in the lock file path
209 hashed_model_name = hashlib.sha256(model_name.encode()).hexdigest()
210
211 cache_dir = cache_dir or temp_dir
212 os.makedirs(cache_dir, exist_ok=True)
213
214 lock_file_path = os.path.join(cache_dir, f"{hashed_model_name}.lock")
215
216 return filelock.FileLock(lock_file_path)
217
218
219class DisabledTqdm(tqdm):

Callers 2

download_hf_modelFunction · 0.85

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected