ApsidalSolid4 commited on
Commit
0fc43d5
·
verified ·
1 Parent(s): 25f2b88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -103,13 +103,13 @@ class TextClassifier:
103
 
104
  self.model = AutoModelForSequenceClassification.from_pretrained(
105
  self.model_name,
106
- num_labels=2,
107
- torchscript=True # Enable TorchScript optimization
108
  ).to(self.device)
109
 
110
  if self.device.type == 'cpu':
111
- self.model.eval() # Ensure model is in eval mode for optimization
112
- self.model = torch.jit.optimize_for_inference(torch.jit.script(self.model))
 
113
 
114
  model_path = "model_20250209_184929_acc1.0000.pt"
115
  if os.path.exists(model_path):
 
103
 
104
  self.model = AutoModelForSequenceClassification.from_pretrained(
105
  self.model_name,
106
+ num_labels=2
 
107
  ).to(self.device)
108
 
109
  if self.device.type == 'cpu':
110
+ # Enable faster CPU performance without TorchScript
111
+ torch.set_num_threads(MAX_WORKERS)
112
+ torch.set_num_interop_threads(MAX_WORKERS)
113
 
114
  model_path = "model_20250209_184929_acc1.0000.pt"
115
  if os.path.exists(model_path):