MCPcopy
hub / github.com/InternLM/InternLM / load

Method load

internlm/utils/storage_manager.py:207–228  ·  view source on GitHub ↗

Args: fp (str): Path to save, eg. s3://opennlplab/model_weights/xxx/ddd.pt

(
        handler,
        bucket_name: str,
        fp: str,
        local_nvme_path: str,  # pylint: disable=W0613
        *args,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

205
206 @staticmethod
207 def load(
208 handler,
209 bucket_name: str,
210 fp: str,
211 local_nvme_path: str, # pylint: disable=W0613
212 *args,
213 **kwargs,
214 ) -> Dict:
215 """
216 Args:
217 fp (str): Path to save, eg. s3://opennlplab/model_weights/xxx/ddd.pt
218 """
219 try:
220 with io.BytesIO() as f:
221 handler.client.download_fileobj(bucket_name, fp, f, Config=handler.config)
222 f.seek(0)
223 states = torch.load(f, *args, **kwargs)
224 except handler.botocore.exceptions.EndpointConnectionError as exc:
225 raise RuntimeError(
226 f"Boto3 Network Error: Please Check your Internet Connection in {socket.gethostname()}"
227 ) from exc
228 return states
229
230 @staticmethod
231 def assert_fp_exists(handler, bucket_name: str, fp: str, local_nvme_path: str): # pylint: disable=W0613

Callers 9

processFunction · 0.45
text2binFunction · 0.45
loadFunction · 0.45
convert2hf.pyFile · 0.45
llm_loadFunction · 0.45
loadMethod · 0.45
loadMethod · 0.45
__init__Method · 0.45
generate_new_configFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected