Commit
·
fe49800
1
Parent(s):
05947c2
Add additional catch for gated model
Browse files
backend/app/services/models.py
CHANGED
@@ -510,7 +510,6 @@ class ModelService(HuggingFaceService):
|
|
510 |
raise ValueError(error_message)
|
511 |
|
512 |
# Check in all statuses (pending, evaluating, finished)
|
513 |
-
print(model_data)
|
514 |
for status, models in existing_models.items():
|
515 |
for model in models:
|
516 |
print(model)
|
@@ -531,8 +530,6 @@ class ModelService(HuggingFaceService):
|
|
531 |
logger.error(LogFormatter.error("Failed to check existing submissions", e))
|
532 |
raise
|
533 |
|
534 |
-
print(model_info)
|
535 |
-
|
536 |
# Check that model on hub and valid
|
537 |
valid, error, model_config = await self.validator.is_model_on_hub(
|
538 |
model_data["model_id"],
|
|
|
510 |
raise ValueError(error_message)
|
511 |
|
512 |
# Check in all statuses (pending, evaluating, finished)
|
|
|
513 |
for status, models in existing_models.items():
|
514 |
for model in models:
|
515 |
print(model)
|
|
|
530 |
logger.error(LogFormatter.error("Failed to check existing submissions", e))
|
531 |
raise
|
532 |
|
|
|
|
|
533 |
# Check that model on hub and valid
|
534 |
valid, error, model_config = await self.validator.is_model_on_hub(
|
535 |
model_data["model_id"],
|
backend/app/utils/model_validation.py
CHANGED
@@ -12,6 +12,7 @@ from app.core.formatting import LogFormatter
|
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
|
|
15 |
|
16 |
class ModelValidator:
|
17 |
def __init__(self):
|
@@ -269,8 +270,14 @@ class ModelValidator:
|
|
269 |
f"The tokenizer is not available in an official Transformers release: {e}",
|
270 |
None,
|
271 |
)
|
272 |
-
except Exception
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
return (
|
275 |
False,
|
276 |
"The tokenizer cannot be loaded. Ensure the tokenizer class is part of a stable Transformers release and correctly configured.",
|
@@ -289,7 +296,7 @@ class ModelValidator:
|
|
289 |
if gated:
|
290 |
return (
|
291 |
False,
|
292 |
-
|
293 |
None,
|
294 |
)
|
295 |
return (
|
|
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
15 |
+
GATED_ERROR = "The model is gated by the model authors and requires special access permissions. Please contact us to request evaluation."
|
16 |
|
17 |
class ModelValidator:
|
18 |
def __init__(self):
|
|
|
270 |
f"The tokenizer is not available in an official Transformers release: {e}",
|
271 |
None,
|
272 |
)
|
273 |
+
except Exception:
|
274 |
+
# When running on hugging face we get into this except block instead of the one below
|
275 |
+
if gated:
|
276 |
+
return (
|
277 |
+
False,
|
278 |
+
GATED_ERROR,
|
279 |
+
None,
|
280 |
+
)
|
281 |
return (
|
282 |
False,
|
283 |
"The tokenizer cannot be loaded. Ensure the tokenizer class is part of a stable Transformers release and correctly configured.",
|
|
|
296 |
if gated:
|
297 |
return (
|
298 |
False,
|
299 |
+
GATED_ERROR,
|
300 |
None,
|
301 |
)
|
302 |
return (
|