Spaces:
Running
on
Zero
Running
on
Zero
handle gpu quota
Browse files
app.py
CHANGED
@@ -961,42 +961,42 @@ def run_fn(
|
|
961 |
}
|
962 |
# print(kwargs)
|
963 |
|
964 |
-
|
965 |
-
|
966 |
-
if old_school_ncut:
|
967 |
-
return super_duper_long_run(model, images, **kwargs)
|
968 |
-
|
969 |
-
if is_lisa:
|
970 |
-
return super_duper_long_run(model, images, **kwargs)
|
971 |
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
return long_run(model, images, **kwargs)
|
985 |
-
if embedding_method == "UMAP":
|
986 |
-
if perplexity >= 250 or num_sample_tsne >= 500:
|
987 |
return longer_run(model, images, **kwargs)
|
988 |
-
|
989 |
-
|
990 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
991 |
return long_run(model, images, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
992 |
return quick_run(model, images, **kwargs)
|
993 |
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
# gr.Error(str(e))
|
999 |
-
# gr.Info("Running out of GPU Quota? Try this demo hosted at UPenn.\n https://ncut-pytorch.readthedocs.io/en/latest/demo/")
|
1000 |
|
1001 |
|
1002 |
|
|
|
961 |
}
|
962 |
# print(kwargs)
|
963 |
|
964 |
+
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
965 |
|
966 |
+
if old_school_ncut:
|
967 |
+
return super_duper_long_run(model, images, **kwargs)
|
968 |
+
|
969 |
+
if is_lisa:
|
970 |
+
return super_duper_long_run(model, images, **kwargs)
|
971 |
+
|
972 |
+
num_images = len(images)
|
973 |
+
if num_images >= 100:
|
974 |
+
return super_duper_long_run(model, images, **kwargs)
|
975 |
+
if 'diffusion' in model_name.lower():
|
976 |
+
return super_duper_long_run(model, images, **kwargs)
|
977 |
+
if recursion:
|
|
|
|
|
|
|
978 |
return longer_run(model, images, **kwargs)
|
979 |
+
if num_images >= 50:
|
980 |
+
return longer_run(model, images, **kwargs)
|
981 |
+
if old_school_ncut:
|
982 |
+
return longer_run(model, images, **kwargs)
|
983 |
+
if num_images >= 10:
|
984 |
+
return long_run(model, images, **kwargs)
|
985 |
+
if embedding_method == "UMAP":
|
986 |
+
if perplexity >= 250 or num_sample_tsne >= 500:
|
987 |
+
return longer_run(model, images, **kwargs)
|
988 |
return long_run(model, images, **kwargs)
|
989 |
+
if embedding_method == "t-SNE":
|
990 |
+
if perplexity >= 250 or num_sample_tsne >= 500:
|
991 |
+
return long_run(model, images, **kwargs)
|
992 |
+
return quick_run(model, images, **kwargs)
|
993 |
+
|
994 |
return quick_run(model, images, **kwargs)
|
995 |
|
996 |
+
except gr.Error as e:
|
997 |
+
print(e)
|
998 |
+
gr.Error(str(e))
|
999 |
+
gr.Info("Running out of HuggingFace GPU Quota? Try this demo hosted at UPenn.\n\n https://ncut-pytorch.readthedocs.io/en/latest/demo/")
|
|
|
|
|
1000 |
|
1001 |
|
1002 |
|