File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 38
38
39
39
40
40
torch .set_grad_enabled (False )
41
+ always_normalize_model_id = None
41
42
42
43
43
44
class DummySafetyChecker :
@@ -71,7 +72,6 @@ def init():
71
72
last_model_id = None
72
73
73
74
if not RUNTIME_DOWNLOADS :
74
- # Uh doesn't this break non-cached images? TODO... IMAGE_CACHE
75
75
normalized_model_id = normalize_model_id (MODEL_ID , MODEL_REVISION )
76
76
model_dir = os .path .join (MODELS_DIR , normalized_model_id )
77
77
if os .path .isdir (model_dir ):
@@ -80,7 +80,7 @@ def init():
80
80
normalized_model_id = MODEL_ID
81
81
82
82
model = loadModel (
83
- model_id = model_dir ,
83
+ model_id = always_normalize_model_id or MODEL_ID ,
84
84
load = True ,
85
85
precision = MODEL_PRECISION ,
86
86
revision = MODEL_REVISION ,
@@ -187,7 +187,9 @@ def inference(all_inputs: dict) -> dict:
187
187
clearPipelines ()
188
188
if model :
189
189
model .to ("cpu" ) # Necessary to avoid a memory leak
190
- model = loadModel (model_id = normalized_model_id , load = True , precision = model_precision )
190
+ model = loadModel (
191
+ model_id = normalized_model_id , load = True , precision = model_precision
192
+ )
191
193
last_model_id = normalized_model_id
192
194
else :
193
195
if always_normalize_model_id :
You can’t perform that action at this time.
0 commit comments