Ani14 commited on
Commit
76e1f82
·
verified ·
1 Parent(s): 1738f9f

Update model_handler.py

Browse files
Files changed (1) hide show
  1. model_handler.py +13 -8
model_handler.py CHANGED
@@ -22,19 +22,24 @@ import torch
22
  if not hasattr(torch, "xpu"):
23
  class _DummyXPU:
24
  @staticmethod
25
- def empty_cache() -> None:
26
- # No‑op: nothing to clear on CPU‑only builds.
27
  return None
28
  @staticmethod
29
- def is_available() -> bool:
30
- # Always report unavailable on CPU‑only builds.
 
 
31
  return False
32
  @staticmethod
33
- def device_count() -> int:
34
- # Zero XPU devices available.
 
 
35
  return 0
36
- # Attach dummy XPU to torch
37
- torch.xpu = _DummyXPU() # type: ignore[attr-defined]
 
 
38
  import time
39
  from typing import Optional, Tuple, Any
40
  from transformers import UMT5EncoderModel
 
22
  if not hasattr(torch, "xpu"):
23
  class _DummyXPU:
24
  @staticmethod
25
+ def empty_cache():
 
26
  return None
27
  @staticmethod
28
+ def manual_seed(_seed: int):
29
+ return None
30
+ @staticmethod
31
+ def is_available():
32
  return False
33
  @staticmethod
34
+ def device_count():
35
+ return 0
36
+ @staticmethod
37
+ def current_device():
38
  return 0
39
+ @staticmethod
40
+ def set_device(_idx: int):
41
+ return None
42
+ torch.xpu = _DummyXPU() # type: ignore
43
  import time
44
  from typing import Optional, Tuple, Any
45
  from transformers import UMT5EncoderModel