(fn:str)
| 180 | return {name: convert(name) for name in {name: None for model in models for name in model}} |
| 181 | |
| 182 | def 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 | |
| 192 | class LLaMa: |
| 193 | @staticmethod |
no test coverage detected
searching dependent graphs…