Update app.py
Browse files
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 |
-
|
| 112 |
-
|
|
|
|
| 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):
|