MCPcopy
hub / github.com/ModelTC/LightLLM / load_pretrain

Method load_pretrain

lightllm/utils/petrel_helper.py:117–129  ·  view source on GitHub ↗
(self, path, map_location=None)

Source from the content-addressed store, hash-verified

115 return filenames
116
117 def load_pretrain(self, path, map_location=None):
118 if "s3://" not in path:
119 assert os.path.exists(path), f"No such file: {path}"
120 return torch.load(path, map_location=map_location, weights_only=True)
121 elif "http://" in path:
122 return torch.hub.load_state_dict_from_url(path, map_location=map_location)
123 else:
124 self.check_init()
125
126 file_bytes = self.client.get(path)
127 buffer = io.BytesIO(file_bytes)
128 res = torch.load(buffer, map_location=map_location, weights_only=True)
129 return res
130
131 @staticmethod
132 def load(path, **kwargs):

Callers 1

loadMethod · 0.80

Calls 4

check_initMethod · 0.95
existsMethod · 0.80
loadMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected