MCPcopy Index your code
hub / github.com/microsoft/BitNet / find_multifile_paths

Function find_multifile_paths

utils/convert.py:1384–1399  ·  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

1382
1383
1384def find_multifile_paths(path: Path) -> list[Path]:
1385 '''Given any path belonging to a multi-file model (e.g. foo.bin.1), return
1386 the whole list of paths in the model.
1387 '''
1388 ret: list[Path] = []
1389 for i in itertools.count():
1390 nth_path = nth_multifile_path(path, i)
1391 if nth_path is None:
1392 break
1393 ret.append(nth_path)
1394 if not ret:
1395 # No matches. This should only happen if the file was named, e.g.,
1396 # foo.0, and there was no file named foo. Oh well, try to process it
1397 # as a single file.
1398 return [path]
1399 return ret
1400
1401
1402def load_some_model(path: Path) -> ModelPlus:

Callers 1

load_some_modelFunction · 0.70

Calls 1

nth_multifile_pathFunction · 0.70

Tested by

no test coverage detected