TiGa-RCE commited on
Commit
647387b
·
verified ·
1 Parent(s): bcba9be

Add direct-load BF16 repeat comparison

Browse files
Files changed (1) hide show
  1. app.py +23 -16
app.py CHANGED
@@ -287,22 +287,21 @@ def _run_family_bf16_control(family: str) -> dict:
287
  torch.cuda.reset_peak_memory_stats()
288
  torch.cuda.synchronize()
289
  allocation_before = int(torch.cuda.memory_allocated())
290
- if family == "qwen3-embedding-8b":
291
- family_tokenizer = qwen8_tokenizer
292
- load_started = time.perf_counter()
293
- family_model = AutoModel.from_pretrained(
294
- QWEN8_MODEL_PATH,
295
- dtype=torch.bfloat16,
296
- trust_remote_code=True,
297
- low_cpu_mem_usage=True,
298
- device_map={"": "cuda"},
299
- ).eval()
300
- torch.cuda.synchronize()
301
- load_seconds = time.perf_counter() - load_started
302
- loading_strategy = "in-call-direct-cuda-device-map"
303
- owns_model = True
304
- else:
305
- raise RuntimeError("GTE 1.5B BF16 control is offline during the 8B phase")
306
  allocation_after_load = int(torch.cuda.memory_allocated())
307
 
308
  encode_started = time.perf_counter()
@@ -339,6 +338,14 @@ def _run_family_bf16_control(family: str) -> dict:
339
  "mlx_bf16_comparison": compare_vectors(
340
  queries, documents, scores, ranks, local_reference, "cuda_vs_mlx_bf16"
341
  ),
 
 
 
 
 
 
 
 
342
  }
343
  output_dir = DATA_ROOT / "cloud-results" / family
344
  output_dir.mkdir(parents=True, exist_ok=True)
 
287
  torch.cuda.reset_peak_memory_stats()
288
  torch.cuda.synchronize()
289
  allocation_before = int(torch.cuda.memory_allocated())
290
+ family_tokenizer = AutoTokenizer.from_pretrained(
291
+ spec["path"], padding_side="left", trust_remote_code=True
292
+ )
293
+ load_started = time.perf_counter()
294
+ family_model = AutoModel.from_pretrained(
295
+ spec["path"],
296
+ dtype=torch.bfloat16,
297
+ trust_remote_code=True,
298
+ low_cpu_mem_usage=True,
299
+ device_map={"": "cuda"},
300
+ ).eval()
301
+ torch.cuda.synchronize()
302
+ load_seconds = time.perf_counter() - load_started
303
+ loading_strategy = "in-call-direct-cuda-device-map"
304
+ owns_model = True
 
305
  allocation_after_load = int(torch.cuda.memory_allocated())
306
 
307
  encode_started = time.perf_counter()
 
338
  "mlx_bf16_comparison": compare_vectors(
339
  queries, documents, scores, ranks, local_reference, "cuda_vs_mlx_bf16"
340
  ),
341
+ "previous_cuda_bf16_comparison": compare_vectors(
342
+ queries,
343
+ documents,
344
+ scores,
345
+ ranks,
346
+ DATA_ROOT / "cloud-results" / family / "cuda-bf16-root-pack.npz",
347
+ "direct_vs_root_pack_bf16",
348
+ ),
349
  }
350
  output_dir = DATA_ROOT / "cloud-results" / family
351
  output_dir.mkdir(parents=True, exist_ok=True)