bhardwaj08sarthak commited on
Commit
bc8ffe3
·
verified ·
1 Parent(s): 00dcf6d

Update level_classifier_tool_2.py

Browse files
Files changed (1) hide show
  1. level_classifier_tool_2.py +2 -4
level_classifier_tool_2.py CHANGED
@@ -21,10 +21,8 @@ class HFEmbeddingBackend:
21
  MODEL: Any = field(init=False, repr=False)
22
 
23
  def __post_init__(self):
24
-
25
  os.environ.setdefault("SPACES_ZERO_DISABLED", "1")
26
-
27
- try:
28
  torch.backends.cuda.sdp_kernel(enable_math=True, enable_flash=False, enable_mem_efficient=False)
29
  except Exception:
30
  pass
@@ -65,7 +63,7 @@ class HFEmbeddingBackend:
65
  all_out.append(pooled.cpu())
66
 
67
  embs = torch.cat(all_out, dim=0) if all_out else torch.empty((0, self.MODEL.config.hidden_size)) # type: ignore
68
- return embs, texts_list----------------- Utilities ---------------------------
69
 
70
  def _normalize_whitespace(s: str) -> str:
71
  return " ".join(s.strip().split())
 
21
  MODEL: Any = field(init=False, repr=False)
22
 
23
  def __post_init__(self):
 
24
  os.environ.setdefault("SPACES_ZERO_DISABLED", "1")
25
+ try:
 
26
  torch.backends.cuda.sdp_kernel(enable_math=True, enable_flash=False, enable_mem_efficient=False)
27
  except Exception:
28
  pass
 
63
  all_out.append(pooled.cpu())
64
 
65
  embs = torch.cat(all_out, dim=0) if all_out else torch.empty((0, self.MODEL.config.hidden_size)) # type: ignore
66
+ return embs, texts_list
67
 
68
  def _normalize_whitespace(s: str) -> str:
69
  return " ".join(s.strip().split())