MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / find_multifile_paths

Function find_multifile_paths

convert.py:1073–1088  ·  view source on GitHub ↗

Given any path belonging to a multi-file model (e.g. foo.bin.1), return the whole list of paths in the model.

(path: Path)

Source from the content-addressed store, hash-verified

1071
1072
1073def find_multifile_paths(path: Path) -> list[Path]:
1074 '''Given any path belonging to a multi-file model (e.g. foo.bin.1), return
1075 the whole list of paths in the model.
1076 '''
1077 ret: list[Path] = []
1078 for i in itertools.count():
1079 nth_path = nth_multifile_path(path, i)
1080 if nth_path is None:
1081 break
1082 ret.append(nth_path)
1083 if not ret:
1084 # No matches. This should only happen if the file was named, e.g.,
1085 # foo.0, and there was no file named foo. Oh well, try to process it
1086 # as a single file.
1087 return [path]
1088 return ret
1089
1090
1091def load_some_model(path: Path) -> ModelPlus:

Callers 2

load_some_modelFunction · 0.70
load_predictor_modelFunction · 0.70

Calls 3

nth_multifile_pathFunction · 0.70
countMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected