Skip to content

Commit f947047

Browse files
Have a chain of use_local. If the param is specified, use that, otherwise read from use_local. Force the app_inference_spec to use local.
1 parent 789a2da commit f947047

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app_inference_spec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def device_name(self):
4242

4343
def load(self):
4444
kwargs = {
45-
"device": self.device_name
45+
"device": self.device_name,
46+
"use_local": True
4647
}
4748
read_from = os.environ.get("MODEL_PATH", "s3").lower()
4849
if read_from == "s3":

validator/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ def __init__(
7777
self.embedding_model = None
7878
self.known_malicious_embeddings = []
7979

80+
# It's possible for self.use_local to be unset and in some indeterminate state.
81+
# First take use_local as a kwarg as the truth.
82+
# If that's not present, try self.use_local.
83+
# If that's not present, default to true.
84+
if "use_local" in kwargs:
85+
self.use_local = kwargs["use_local"]
86+
elif self.use_local is None:
87+
self.use_local = True
88+
8089
if self.use_local:
8190
if not model_path_override:
8291
self.saturation_attack_detector = PromptSaturationDetectorV3(

0 commit comments

Comments
 (0)