MCPcopy
hub / github.com/tinygrad/tinygrad / load

Function load

examples/llama.py:182–190  ·  view source on GitHub ↗
(fn:str)

Source from the content-addressed store, hash-verified

180 return {name: convert(name) for name in {name: None for model in models for name in model}}
181
182def load(fn:str):
183 if fn.endswith('.index.json'):
184 with open(fn) as fp: weight_map = json.load(fp)['weight_map']
185 parts = {n: load(str(Path(fn).parent / Path(n).name)) for n in set(weight_map.values())}
186 return {k: parts[n][k] for k, n in weight_map.items()}
187 elif fn.endswith(".safetensors"):
188 return safe_load(fn)
189 else:
190 return torch_load(fn)
191
192class LLaMa:
193 @staticmethod

Callers 1

buildMethod · 0.70

Calls 3

safe_loadFunction · 0.90
torch_loadFunction · 0.90
loadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…