Cion-lab commited on
Commit
ea283ea
·
verified ·
1 Parent(s): 919e5d4

p0d v4: worker receives its chunk filename; note rayon non-scaling

Browse files
Files changed (1) hide show
  1. probes/p0d_ingest_throughput.py +6 -2
probes/p0d_ingest_throughput.py CHANGED
@@ -92,10 +92,14 @@ if len(sys.argv) > 1 and sys.argv[1] == "tokworker":
92
 
93
  tk = Tokenizer.from_file(os.environ["TOK_JSON"])
94
  tk.no_truncation()
95
- with open("/dev/shm/" + sys.argv[2]) as f:
 
96
  chunks = json.load(f)
97
  t = time.monotonic()
98
- enc = tk.encode_batch(chunks) # rayon-parallel across cores, released GIL
 
 
 
99
  el = time.monotonic() - t
100
  n = sum(len(e.ids) for e in enc)
101
  print("TOKRESULT " + json.dumps({"tokens": n, "seconds": round(el, 2),
 
92
 
93
  tk = Tokenizer.from_file(os.environ["TOK_JSON"])
94
  tk.no_truncation()
95
+ chunk_file = sys.argv[2] if len(sys.argv) > 2 else "p0d_chunks.json"
96
+ with open("/dev/shm/" + chunk_file) as f:
97
  chunks = json.load(f)
98
  t = time.monotonic()
99
+ enc = tk.encode_batch(chunks)
100
+ # Locally (same tokenizers 0.22.2) RAYON_NUM_THREADS did not move the needle at all: 198k tok/s
101
+ # at 1 thread vs 199k at 4. So `encode_batch` may not be core-parallel after all, which is why
102
+ # this probe re-execs a fresh process per setting instead of trusting an env var mid-process.
103
  el = time.monotonic() - t
104
  n = sum(len(e.ids) for e in enc)
105
  print("TOKRESULT " + json.dumps({"tokens": n, "seconds": round(el, 2),