We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3f65a47 + b9498fc commit cbd0e85Copy full SHA for cbd0e85
src/bioclip/predict.py
@@ -1,3 +1,4 @@
1
+import os
2
import json
3
import torch
4
from torchvision import transforms
@@ -19,6 +20,13 @@
19
20
PRED_CLASSICATION_KEY = "classification"
21
PRED_SCORE_KEY = "score"
22
23
+
24
+# Use secure model loading unless explicitly disabled.
25
+# See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more.
26
+if not "TORCH_FORCE_WEIGHTS_ONLY_LOAD" in os.environ:
27
+ os.environ["TORCH_FORCE_WEIGHTS_ONLY_LOAD"] = "true"
28
29
30
OPENA_AI_IMAGENET_TEMPLATE = [
31
lambda c: f"a bad photo of a {c}.",
32
lambda c: f"a photo of many {c}.",
0 commit comments