Daniel Kantor
commited on
Commit
·
d7d7ccf
1
Parent(s):
7b81f2b
use correct dataset for model submission
Browse files
backend/app/services/models.py
CHANGED
@@ -20,7 +20,7 @@ from app.config import (
|
|
20 |
HF_TOKEN,
|
21 |
EVAL_REQUESTS_PATH
|
22 |
)
|
23 |
-
from app.config.hf_config import HF_ORGANIZATION
|
24 |
from app.services.hf_service import HuggingFaceService
|
25 |
from app.utils.model_validation import ModelValidator
|
26 |
from app.services.votes import VoteService
|
@@ -206,7 +206,7 @@ class ModelService(HuggingFaceService):
|
|
206 |
"""Refresh the models cache"""
|
207 |
try:
|
208 |
logger.info(LogFormatter.section("CACHE REFRESH"))
|
209 |
-
self._log_repo_operation("read",
|
210 |
|
211 |
# Initialize models dictionary
|
212 |
models = {
|
@@ -401,7 +401,7 @@ class ModelService(HuggingFaceService):
|
|
401 |
user_id: str
|
402 |
) -> Dict[str, Any]:
|
403 |
logger.info(LogFormatter.section("MODEL SUBMISSION"))
|
404 |
-
self._log_repo_operation("write",
|
405 |
stats = {
|
406 |
"Model": model_data["model_id"],
|
407 |
"User": user_id,
|
@@ -551,7 +551,7 @@ class ModelService(HuggingFaceService):
|
|
551 |
# Upload to HF dataset
|
552 |
try:
|
553 |
logger.info(LogFormatter.subsection("UPLOADING TO HUGGINGFACE"))
|
554 |
-
logger.info(LogFormatter.info(f"Uploading to {
|
555 |
|
556 |
# Construct the path in the dataset
|
557 |
org_or_user = model_data["model_id"].split("/")[0] if "/" in model_data["model_id"] else ""
|
@@ -568,7 +568,7 @@ class ModelService(HuggingFaceService):
|
|
568 |
self.hf_api.upload_file(
|
569 |
path_or_fileobj=temp_path,
|
570 |
path_in_repo=relative_path,
|
571 |
-
repo_id=
|
572 |
repo_type="dataset",
|
573 |
commit_message=f"Add {model_data['model_id']} to eval queue",
|
574 |
token=self.token
|
@@ -665,4 +665,4 @@ class ModelService(HuggingFaceService):
|
|
665 |
|
666 |
except Exception as e:
|
667 |
logger.error(LogFormatter.error(f"Failed to get submissions for {organization}", e))
|
668 |
-
raise
|
|
|
20 |
HF_TOKEN,
|
21 |
EVAL_REQUESTS_PATH
|
22 |
)
|
23 |
+
from app.config.hf_config import HF_ORGANIZATION, QUEUE_REPO
|
24 |
from app.services.hf_service import HuggingFaceService
|
25 |
from app.utils.model_validation import ModelValidator
|
26 |
from app.services.votes import VoteService
|
|
|
206 |
"""Refresh the models cache"""
|
207 |
try:
|
208 |
logger.info(LogFormatter.section("CACHE REFRESH"))
|
209 |
+
self._log_repo_operation("read", QUEUE_REPO, "Refreshing models cache")
|
210 |
|
211 |
# Initialize models dictionary
|
212 |
models = {
|
|
|
401 |
user_id: str
|
402 |
) -> Dict[str, Any]:
|
403 |
logger.info(LogFormatter.section("MODEL SUBMISSION"))
|
404 |
+
self._log_repo_operation("write", QUEUE_REPO, f"Submitting model {model_data['model_id']} by {user_id}")
|
405 |
stats = {
|
406 |
"Model": model_data["model_id"],
|
407 |
"User": user_id,
|
|
|
551 |
# Upload to HF dataset
|
552 |
try:
|
553 |
logger.info(LogFormatter.subsection("UPLOADING TO HUGGINGFACE"))
|
554 |
+
logger.info(LogFormatter.info(f"Uploading to {QUEUE_REPO}..."))
|
555 |
|
556 |
# Construct the path in the dataset
|
557 |
org_or_user = model_data["model_id"].split("/")[0] if "/" in model_data["model_id"] else ""
|
|
|
568 |
self.hf_api.upload_file(
|
569 |
path_or_fileobj=temp_path,
|
570 |
path_in_repo=relative_path,
|
571 |
+
repo_id=QUEUE_REPO,
|
572 |
repo_type="dataset",
|
573 |
commit_message=f"Add {model_data['model_id']} to eval queue",
|
574 |
token=self.token
|
|
|
665 |
|
666 |
except Exception as e:
|
667 |
logger.error(LogFormatter.error(f"Failed to get submissions for {organization}", e))
|
668 |
+
raise
|