Spaces:
Running on Zero
Running on Zero
Add direct-load BF16 repeat comparison
Browse files
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 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 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)
|