Commit
·
6fba7eb
1
Parent(s):
73fea0f
Handle gated models
Browse files
backend/app/services/models.py
CHANGED
@@ -536,7 +536,7 @@ class ModelService(HuggingFaceService):
|
|
536 |
|
537 |
# Check that model on hub and valid
|
538 |
valid, error, model_config = await self.validator.is_model_on_hub(
|
539 |
-
model_data["model_id"], model_data["revision"], test_tokenizer=True
|
540 |
)
|
541 |
if not valid:
|
542 |
logger.error(LogFormatter.error("Model on hub validation failed", error))
|
|
|
536 |
|
537 |
# Check that model on hub and valid
|
538 |
valid, error, model_config = await self.validator.is_model_on_hub(
|
539 |
+
model_data["model_id"], model_data["revision"], model_info.gated, test_tokenizer=True
|
540 |
)
|
541 |
if not valid:
|
542 |
logger.error(LogFormatter.error("Model on hub validation failed", error))
|
backend/app/utils/model_validation.py
CHANGED
@@ -184,6 +184,7 @@ class ModelValidator:
|
|
184 |
self,
|
185 |
model_name: str,
|
186 |
revision: str,
|
|
|
187 |
test_tokenizer: bool = False,
|
188 |
trust_remote_code: bool = False,
|
189 |
) -> Tuple[bool, Optional[str], Optional[Any]]:
|
@@ -229,10 +230,10 @@ class ModelValidator:
|
|
229 |
None,
|
230 |
)
|
231 |
except Exception as e:
|
232 |
-
if
|
233 |
return (
|
234 |
True,
|
235 |
-
"The model is gated and requires special access permissions.",
|
236 |
None,
|
237 |
)
|
238 |
return (
|
|
|
184 |
self,
|
185 |
model_name: str,
|
186 |
revision: str,
|
187 |
+
gated: bool = False,
|
188 |
test_tokenizer: bool = False,
|
189 |
trust_remote_code: bool = False,
|
190 |
) -> Tuple[bool, Optional[str], Optional[Any]]:
|
|
|
230 |
None,
|
231 |
)
|
232 |
except Exception as e:
|
233 |
+
if gated:
|
234 |
return (
|
235 |
True,
|
236 |
+
"The model is gated by the model authors and requires special access permissions. Please contact us to request evaluation.",
|
237 |
None,
|
238 |
)
|
239 |
return (
|