MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / find_multifile_paths

Function find_multifile_paths

tokenizer/convert/convert.py:1242–1257  ·  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

1240
1241
1242def find_multifile_paths(path: Path) -> list[Path]:
1243 '''Given any path belonging to a multi-file model (e.g. foo.bin.1), return
1244 the whole list of paths in the model.
1245 '''
1246 ret: list[Path] = []
1247 for i in itertools.count():
1248 nth_path = nth_multifile_path(path, i)
1249 if nth_path is None:
1250 break
1251 ret.append(nth_path)
1252 if not ret:
1253 # No matches. This should only happen if the file was named, e.g.,
1254 # foo.0, and there was no file named foo. Oh well, try to process it
1255 # as a single file.
1256 return [path]
1257 return ret
1258
1259
1260def load_some_model(path: Path) -> ModelPlus:

Callers 1

load_some_modelFunction · 0.85

Calls 1

nth_multifile_pathFunction · 0.85

Tested by

no test coverage detected