TiGa-RCE commited on
Commit
bd2dad5
·
verified ·
1 Parent(s): 97e5e64

Switch larger-family control to root-loaded Qwen3 8B

Browse files
Files changed (1) hide show
  1. app.py +11 -17
app.py CHANGED
@@ -37,9 +37,13 @@ model = None
37
  # larger-family path loaded this model inside the decorated call and exhausted
38
  # that reservation before producing an artifact.
39
  GTE_MODEL_PATH = Path("/models/gte-qwen2-1.5b")
40
- gte_tokenizer = AutoTokenizer.from_pretrained(GTE_MODEL_PATH, padding_side="left")
41
- gte_model = AutoModel.from_pretrained(
42
- GTE_MODEL_PATH,
 
 
 
 
43
  dtype=torch.bfloat16,
44
  trust_remote_code=True,
45
  ).to("cuda").eval()
@@ -287,24 +291,14 @@ 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 == "gte-qwen2-1.5b":
291
- family_tokenizer = gte_tokenizer
292
- family_model = gte_model
293
  load_seconds = 0.0
294
  loading_strategy = "root-module-cuda-emulation"
295
  owns_model = False
296
  else:
297
- load_started = time.perf_counter()
298
- family_tokenizer = AutoTokenizer.from_pretrained(
299
- spec["path"], padding_side="left"
300
- )
301
- family_model = AutoModel.from_pretrained(
302
- spec["path"], dtype=torch.bfloat16, trust_remote_code=True
303
- ).to("cuda").eval()
304
- torch.cuda.synchronize()
305
- load_seconds = time.perf_counter() - load_started
306
- loading_strategy = "in-call-cuda-placement"
307
- owns_model = True
308
  allocation_after_load = int(torch.cuda.memory_allocated())
309
 
310
  encode_started = time.perf_counter()
 
37
  # larger-family path loaded this model inside the decorated call and exhausted
38
  # that reservation before producing an artifact.
39
  GTE_MODEL_PATH = Path("/models/gte-qwen2-1.5b")
40
+ gte_tokenizer = None
41
+ gte_model = None
42
+
43
+ QWEN8_MODEL_PATH = Path("/models/qwen3-embedding-8b")
44
+ qwen8_tokenizer = AutoTokenizer.from_pretrained(QWEN8_MODEL_PATH, padding_side="left")
45
+ qwen8_model = AutoModel.from_pretrained(
46
+ QWEN8_MODEL_PATH,
47
  dtype=torch.bfloat16,
48
  trust_remote_code=True,
49
  ).to("cuda").eval()
 
291
  torch.cuda.reset_peak_memory_stats()
292
  torch.cuda.synchronize()
293
  allocation_before = int(torch.cuda.memory_allocated())
294
+ if family == "qwen3-embedding-8b":
295
+ family_tokenizer = qwen8_tokenizer
296
+ family_model = qwen8_model
297
  load_seconds = 0.0
298
  loading_strategy = "root-module-cuda-emulation"
299
  owns_model = False
300
  else:
301
+ raise RuntimeError("GTE 1.5B BF16 control is offline during the 8B phase")
 
 
 
 
 
 
 
 
 
 
302
  allocation_after_load = int(torch.cuda.memory_allocated())
303
 
304
  encode_started = time.perf_counter()