Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
t0-0
commited on
Commit
·
5c2a910
1
Parent(s):
a784eb3
Handle submission for gated model
Browse files
src/submission/check_validity.py
CHANGED
@@ -3,6 +3,7 @@ import os
|
|
3 |
from collections import defaultdict
|
4 |
|
5 |
import huggingface_hub
|
|
|
6 |
from huggingface_hub import ModelCard
|
7 |
from huggingface_hub.hf_api import ModelInfo
|
8 |
from transformers import AutoConfig
|
@@ -61,6 +62,13 @@ def is_model_on_hub(
|
|
61 |
None,
|
62 |
)
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
except Exception:
|
65 |
return False, "was not found on hub!", None
|
66 |
|
|
|
3 |
from collections import defaultdict
|
4 |
|
5 |
import huggingface_hub
|
6 |
+
import requests
|
7 |
from huggingface_hub import ModelCard
|
8 |
from huggingface_hub.hf_api import ModelInfo
|
9 |
from transformers import AutoConfig
|
|
|
62 |
None,
|
63 |
)
|
64 |
|
65 |
+
except OSError as e:
|
66 |
+
if "gated repo" in str(e):
|
67 |
+
slack_webhook_url = os.environ["SLACK_WEBHOOK_URL"]
|
68 |
+
text = f"<!channel>\n{model_name} is gated model! Please submit this model."
|
69 |
+
requests.post(slack_webhook_url, data=json.dumps({"text": text}))
|
70 |
+
return False, "is gated model! Please wait.", None
|
71 |
+
return False, "was not found on hub!", None
|
72 |
except Exception:
|
73 |
return False, "was not found on hub!", None
|
74 |
|