MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / read_all_files

Function read_all_files

trainer/src/inference_server/main.py:76–89  ·  view source on GitHub ↗
(directory)

Source from the content-addressed store, hash-verified

74
75
76def read_all_files(directory):
77 # Just open each file and read the whole thing into memory. This is a hack
78 # because Modal's `Volume` file system has really bad perf on first read,
79 # especially if you're grabbing just a piece at a time like SafeTensors
80 # does.
81 def read_file(file):
82 with open(file, "r") as f:
83 f.read()
84
85 with ThreadPoolExecutor() as executor:
86 for root, _, files in os.walk(directory):
87 for file in files:
88 file_path = os.path.join(root, file)
89 executor.submit(read_file, file_path)
90
91
92@stub.cls(

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected