Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -27,14 +27,7 @@ tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased-distilled-squ
|
|
27 |
# Set model to evaluation mode
|
28 |
model.eval()
|
29 |
|
30 |
-
#
|
31 |
-
# Use backend="inductor" for CPU optimization
|
32 |
-
try:
|
33 |
-
model = torch.compile(model, backend="inductor")
|
34 |
-
except Exception as e:
|
35 |
-
print(f"Warning: torch.compile failed with error: {str(e)}. Proceeding without compilation.")
|
36 |
-
|
37 |
-
# Apply quantization to the model for additional speedup on CPU
|
38 |
model = torch.quantization.quantize_dynamic(
|
39 |
model, {torch.nn.Linear}, dtype=torch.qint8
|
40 |
)
|
|
|
27 |
# Set model to evaluation mode
|
28 |
model.eval()
|
29 |
|
30 |
+
# Apply quantization to the model for faster inference on CPU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
model = torch.quantization.quantize_dynamic(
|
32 |
model, {torch.nn.Linear}, dtype=torch.qint8
|
33 |
)
|