in oss-model-connector/ossmodelconnector/oss_model_connector.py [0:0]
def prepare_directory(self, uri: str, dir: str, libc_hook: bool = False):
"""
Prepare the directory from OSS storage, which can be used as directory 'dir' in vllm/transformers or other frameworks.
Args:
uri(str): The URI (oss://{bucket}/{directory}) of the OSS directory.
dir(str): The local directory used for vllm/transformers or other frameworks.
libc_hook (bool): Flag to enable libc hooking.
Raises:
RuntimeError: If prepare directory failed.
"""
if not dir.endswith('/'):
dir += '/'
self._connector.prepare_directory(uri, dir, libc_hook)
if not libc_hook:
builtins.open = self._connector_open
torch.UntypedStorage.from_file = self._from_file_helper
self._hook_dir = dir