Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
submission-fix (#1065)
Browse files- Correct official providers (e14240c4ad78a9dcaa02e155dac17cef51a783de)
- Remove TRANSFORMERS_CACHE (cb24abfbcc1f8c6ee56a261eb7db70ed913dd393)
- Bump up huggingface-hub and transformers (9213aedc08bde2e33847e9f094190b4767fb588c)
- Add check_official_provider_status function (c13b5be79785680ddacb2c979dfe3cb2b8397952)
- Integrate check_official_provider_status function (ca4ed4c7deee7eab07adbcab1b315f37607323e6)
- Change helperText (11258bb1c37afb99aee97f3fa5dcac92d1694998)
- Fix imports (495824ca0b45bb763f80d2fc3dc6e56c4e9db1b6)
- Fix logging issue (2a097f52be1ae5411e7073af73061ec29b74811b)
- Uncomment lines and remove hardcode (7017c9f51da052f3f23683fb0e2b13cb55de56d1)
- Dockerfile +0 -1
- backend/README.md +2 -2
- backend/app/api/dependencies.py +1 -1
- backend/app/api/endpoints/leaderboard.py +1 -1
- backend/app/api/endpoints/models.py +1 -1
- backend/app/api/endpoints/votes.py +1 -1
- backend/app/asgi.py +2 -2
- backend/app/config/hf_config.py +1 -5
- backend/app/core/cache.py +4 -4
- backend/app/core/fastapi_cache.py +1 -1
- backend/app/core/formatting.py +104 -0
- backend/app/services/hf_service.py +1 -1
- backend/app/services/leaderboard.py +2 -2
- backend/app/services/models.py +9 -1
- backend/app/services/votes.py +2 -3
- backend/app/utils/logging.py +2 -104
- backend/app/utils/model_validation.py +62 -6
- backend/pyproject.toml +2 -2
- backend/utils/analyze_prod_datasets.py +1 -1
- backend/utils/fix_wrong_model_size.py +2 -2
- backend/utils/sync_datasets_locally.py +1 -1
- frontend/src/pages/AddModelPage/components/ModelSubmissionForm/ModelSubmissionForm.js +1 -1
- frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/FilteredModelCount.js +5 -5
- frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/Filters.js +6 -6
- frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/QuickFilters.js +1 -1
- frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/hooks/useOfficialProvidersMode.js +3 -3
- frontend/src/pages/LeaderboardPage/components/Leaderboard/constants/defaults.js +3 -3
- frontend/src/pages/LeaderboardPage/components/Leaderboard/constants/quickFilters.js +1 -1
- frontend/src/pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext.js +7 -7
- frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useDataUtils.js +5 -5
- frontend/src/pages/LeaderboardPage/components/Leaderboard/utils/columnUtils.js +4 -4
Dockerfile
CHANGED
@@ -49,7 +49,6 @@ WORKDIR /app
|
|
49 |
|
50 |
# Environment variables
|
51 |
ENV HF_HOME=/app/.cache \
|
52 |
-
TRANSFORMERS_CACHE=/app/.cache \
|
53 |
HF_DATASETS_CACHE=/app/.cache \
|
54 |
INTERNAL_API_PORT=7861 \
|
55 |
PORT=7860 \
|
|
|
49 |
|
50 |
# Environment variables
|
51 |
ENV HF_HOME=/app/.cache \
|
|
|
52 |
HF_DATASETS_CACHE=/app/.cache \
|
53 |
INTERNAL_API_PORT=7861 \
|
54 |
PORT=7860 \
|
backend/README.md
CHANGED
@@ -70,7 +70,7 @@ The application uses several datasets on the HuggingFace Hub:
|
|
70 |
- **Format**: Main dataset containing all scores and metrics
|
71 |
- **Updates**: Automatic after model evaluations
|
72 |
|
73 |
-
### 4.
|
74 |
|
75 |
- **Operations**:
|
76 |
- 📥 Read-only access for highlighted models
|
@@ -203,7 +203,7 @@ Swagger documentation available at http://localhost:7860/docs
|
|
203 |
is_merged: boolean,
|
204 |
is_moe: boolean,
|
205 |
is_flagged: boolean,
|
206 |
-
|
207 |
},
|
208 |
metadata: {
|
209 |
upload_date: string,
|
|
|
70 |
- **Format**: Main dataset containing all scores and metrics
|
71 |
- **Updates**: Automatic after model evaluations
|
72 |
|
73 |
+
### 4. Official Providers Dataset (`{HF_ORGANIZATION}/official-providers`)
|
74 |
|
75 |
- **Operations**:
|
76 |
- 📥 Read-only access for highlighted models
|
|
|
203 |
is_merged: boolean,
|
204 |
is_moe: boolean,
|
205 |
is_flagged: boolean,
|
206 |
+
is_official_provider: boolean
|
207 |
},
|
208 |
metadata: {
|
209 |
upload_date: string,
|
backend/app/api/dependencies.py
CHANGED
@@ -2,7 +2,7 @@ from fastapi import Depends, HTTPException
|
|
2 |
import logging
|
3 |
from app.services.models import ModelService
|
4 |
from app.services.votes import VoteService
|
5 |
-
from app.
|
6 |
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
|
|
2 |
import logging
|
3 |
from app.services.models import ModelService
|
4 |
from app.services.votes import VoteService
|
5 |
+
from app.core.formatting import LogFormatter
|
6 |
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
backend/app/api/endpoints/leaderboard.py
CHANGED
@@ -3,7 +3,7 @@ from typing import List, Dict, Any
|
|
3 |
from app.services.leaderboard import LeaderboardService
|
4 |
from app.core.fastapi_cache import cached, build_cache_key
|
5 |
import logging
|
6 |
-
from app.
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
9 |
router = APIRouter()
|
|
|
3 |
from app.services.leaderboard import LeaderboardService
|
4 |
from app.core.fastapi_cache import cached, build_cache_key
|
5 |
import logging
|
6 |
+
from app.core.formatting import LogFormatter
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
9 |
router = APIRouter()
|
backend/app/api/endpoints/models.py
CHANGED
@@ -4,7 +4,7 @@ import logging
|
|
4 |
from app.services.models import ModelService
|
5 |
from app.api.dependencies import get_model_service
|
6 |
from app.core.fastapi_cache import cached
|
7 |
-
from app.
|
8 |
|
9 |
logger = logging.getLogger(__name__)
|
10 |
router = APIRouter(tags=["models"])
|
|
|
4 |
from app.services.models import ModelService
|
5 |
from app.api.dependencies import get_model_service
|
6 |
from app.core.fastapi_cache import cached
|
7 |
+
from app.core.formatting import LogFormatter
|
8 |
|
9 |
logger = logging.getLogger(__name__)
|
10 |
router = APIRouter(tags=["models"])
|
backend/app/api/endpoints/votes.py
CHANGED
@@ -3,7 +3,7 @@ from typing import Dict, Any, List
|
|
3 |
from app.services.votes import VoteService
|
4 |
from app.core.fastapi_cache import cached, build_cache_key, invalidate_cache_key
|
5 |
import logging
|
6 |
-
from app.
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
9 |
router = APIRouter()
|
|
|
3 |
from app.services.votes import VoteService
|
4 |
from app.core.fastapi_cache import cached, build_cache_key, invalidate_cache_key
|
5 |
import logging
|
6 |
+
from app.core.formatting import LogFormatter
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
9 |
router = APIRouter()
|
backend/app/asgi.py
CHANGED
@@ -12,7 +12,7 @@ import sys
|
|
12 |
|
13 |
from app.api.router import router
|
14 |
from app.core.fastapi_cache import setup_cache
|
15 |
-
from app.
|
16 |
from app.config import hf_config
|
17 |
|
18 |
# Configure logging before anything else
|
@@ -99,7 +99,7 @@ async def startup_event():
|
|
99 |
logger.info(LogFormatter.info(f" - Queue: {hf_config.QUEUE_REPO}"))
|
100 |
logger.info(LogFormatter.info(f" - Aggregated: {hf_config.AGGREGATED_REPO}"))
|
101 |
logger.info(LogFormatter.info(f" - Votes: {hf_config.VOTES_REPO}"))
|
102 |
-
logger.info(LogFormatter.info(f" -
|
103 |
|
104 |
# Setup cache
|
105 |
setup_cache()
|
|
|
12 |
|
13 |
from app.api.router import router
|
14 |
from app.core.fastapi_cache import setup_cache
|
15 |
+
from app.core.formatting import LogFormatter
|
16 |
from app.config import hf_config
|
17 |
|
18 |
# Configure logging before anything else
|
|
|
99 |
logger.info(LogFormatter.info(f" - Queue: {hf_config.QUEUE_REPO}"))
|
100 |
logger.info(LogFormatter.info(f" - Aggregated: {hf_config.AGGREGATED_REPO}"))
|
101 |
logger.info(LogFormatter.info(f" - Votes: {hf_config.VOTES_REPO}"))
|
102 |
+
logger.info(LogFormatter.info(f" - Official Providers: {hf_config.OFFICIAL_PROVIDERS_REPO}"))
|
103 |
|
104 |
# Setup cache
|
105 |
setup_cache()
|
backend/app/config/hf_config.py
CHANGED
@@ -1,13 +1,9 @@
|
|
1 |
-
"""
|
2 |
-
Hugging Face configuration module
|
3 |
-
"""
|
4 |
import os
|
5 |
import logging
|
6 |
from typing import Optional
|
7 |
from huggingface_hub import HfApi
|
8 |
from pathlib import Path
|
9 |
from app.core.cache import cache_config
|
10 |
-
from app.utils.logging import LogFormatter
|
11 |
|
12 |
logger = logging.getLogger(__name__)
|
13 |
|
@@ -26,7 +22,7 @@ API = HfApi(token=HF_TOKEN)
|
|
26 |
QUEUE_REPO = f"{HF_ORGANIZATION}/requests"
|
27 |
AGGREGATED_REPO = f"{HF_ORGANIZATION}/contents"
|
28 |
VOTES_REPO = f"{HF_ORGANIZATION}/votes"
|
29 |
-
|
30 |
|
31 |
# File paths from cache config
|
32 |
VOTES_PATH = cache_config.votes_file
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import logging
|
3 |
from typing import Optional
|
4 |
from huggingface_hub import HfApi
|
5 |
from pathlib import Path
|
6 |
from app.core.cache import cache_config
|
|
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
9 |
|
|
|
22 |
QUEUE_REPO = f"{HF_ORGANIZATION}/requests"
|
23 |
AGGREGATED_REPO = f"{HF_ORGANIZATION}/contents"
|
24 |
VOTES_REPO = f"{HF_ORGANIZATION}/votes"
|
25 |
+
OFFICIAL_PROVIDERS_REPO = f"{HF_ORGANIZATION}/official-providers"
|
26 |
|
27 |
# File paths from cache config
|
28 |
VOTES_PATH = cache_config.votes_file
|
backend/app/core/cache.py
CHANGED
@@ -3,7 +3,7 @@ import shutil
|
|
3 |
from pathlib import Path
|
4 |
from datetime import timedelta
|
5 |
import logging
|
6 |
-
from app.
|
7 |
from app.config.base import (
|
8 |
CACHE_ROOT,
|
9 |
DATASETS_CACHE,
|
@@ -58,16 +58,16 @@ class CacheConfig:
|
|
58 |
def _setup_environment(self):
|
59 |
"""Configure HuggingFace environment variables"""
|
60 |
logger.info(LogFormatter.subsection("ENVIRONMENT SETUP"))
|
61 |
-
|
62 |
env_vars = {
|
63 |
"HF_HOME": str(self.cache_root),
|
64 |
-
"TRANSFORMERS_CACHE": str(self.models_cache),
|
65 |
"HF_DATASETS_CACHE": str(self.datasets_cache)
|
66 |
}
|
67 |
-
|
68 |
for var, value in env_vars.items():
|
69 |
os.environ[var] = value
|
70 |
logger.info(LogFormatter.info(f"Set {var}={value}"))
|
|
|
71 |
|
72 |
def get_cache_path(self, cache_type: str) -> Path:
|
73 |
"""Returns the path for a specific cache type"""
|
|
|
3 |
from pathlib import Path
|
4 |
from datetime import timedelta
|
5 |
import logging
|
6 |
+
from app.core.formatting import LogFormatter
|
7 |
from app.config.base import (
|
8 |
CACHE_ROOT,
|
9 |
DATASETS_CACHE,
|
|
|
58 |
def _setup_environment(self):
|
59 |
"""Configure HuggingFace environment variables"""
|
60 |
logger.info(LogFormatter.subsection("ENVIRONMENT SETUP"))
|
61 |
+
|
62 |
env_vars = {
|
63 |
"HF_HOME": str(self.cache_root),
|
|
|
64 |
"HF_DATASETS_CACHE": str(self.datasets_cache)
|
65 |
}
|
66 |
+
|
67 |
for var, value in env_vars.items():
|
68 |
os.environ[var] = value
|
69 |
logger.info(LogFormatter.info(f"Set {var}={value}"))
|
70 |
+
|
71 |
|
72 |
def get_cache_path(self, cache_type: str) -> Path:
|
73 |
"""Returns the path for a specific cache type"""
|
backend/app/core/fastapi_cache.py
CHANGED
@@ -4,7 +4,7 @@ from fastapi_cache.decorator import cache
|
|
4 |
from datetime import timedelta
|
5 |
from app.config import CACHE_TTL
|
6 |
import logging
|
7 |
-
from app.
|
8 |
|
9 |
logger = logging.getLogger(__name__)
|
10 |
|
|
|
4 |
from datetime import timedelta
|
5 |
from app.config import CACHE_TTL
|
6 |
import logging
|
7 |
+
from app.core.formatting import LogFormatter
|
8 |
|
9 |
logger = logging.getLogger(__name__)
|
10 |
|
backend/app/core/formatting.py
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from typing import Dict, Any, List, Optional
|
3 |
+
|
4 |
+
logger = logging.getLogger(__name__)
|
5 |
+
|
6 |
+
class LogFormatter:
|
7 |
+
"""Utility class for consistent log formatting across the application"""
|
8 |
+
|
9 |
+
@staticmethod
|
10 |
+
def section(title: str) -> str:
|
11 |
+
"""Create a section header"""
|
12 |
+
return f"\n{'='*20} {title.upper()} {'='*20}"
|
13 |
+
|
14 |
+
@staticmethod
|
15 |
+
def subsection(title: str) -> str:
|
16 |
+
"""Create a subsection header"""
|
17 |
+
return f"\n{'─'*20} {title} {'─'*20}"
|
18 |
+
|
19 |
+
@staticmethod
|
20 |
+
def tree(items: Dict[str, Any], title: str = None) -> List[str]:
|
21 |
+
"""Create a tree view of dictionary data"""
|
22 |
+
lines = []
|
23 |
+
if title:
|
24 |
+
lines.append(f"📊 {title}:")
|
25 |
+
|
26 |
+
# Get the maximum length for alignment
|
27 |
+
max_key_length = max(len(str(k)) for k in items.keys())
|
28 |
+
|
29 |
+
# Format each item
|
30 |
+
for i, (key, value) in enumerate(items.items()):
|
31 |
+
prefix = "└──" if i == len(items) - 1 else "├──"
|
32 |
+
if isinstance(value, (int, float)):
|
33 |
+
value = f"{value:,}" # Add thousand separators
|
34 |
+
lines.append(f"{prefix} {str(key):<{max_key_length}}: {value}")
|
35 |
+
|
36 |
+
return lines
|
37 |
+
|
38 |
+
@staticmethod
|
39 |
+
def stats(stats: Dict[str, int], title: str = None) -> List[str]:
|
40 |
+
"""Format statistics with icons"""
|
41 |
+
lines = []
|
42 |
+
if title:
|
43 |
+
lines.append(f"📊 {title}:")
|
44 |
+
|
45 |
+
# Get the maximum length for alignment
|
46 |
+
max_key_length = max(len(str(k)) for k in stats.keys())
|
47 |
+
|
48 |
+
# Format each stat with an appropriate icon
|
49 |
+
icons = {
|
50 |
+
"total": "📌",
|
51 |
+
"success": "✅",
|
52 |
+
"error": "❌",
|
53 |
+
"pending": "⏳",
|
54 |
+
"processing": "⚙️",
|
55 |
+
"finished": "✨",
|
56 |
+
"evaluating": "🔄",
|
57 |
+
"downloads": "⬇️",
|
58 |
+
"files": "📁",
|
59 |
+
"cached": "💾",
|
60 |
+
"size": "📏",
|
61 |
+
"time": "⏱️",
|
62 |
+
"rate": "🚀"
|
63 |
+
}
|
64 |
+
|
65 |
+
# Format each item
|
66 |
+
for i, (key, value) in enumerate(stats.items()):
|
67 |
+
prefix = "└──" if i == len(stats) - 1 else "├──"
|
68 |
+
icon = icons.get(key.lower().split('_')[0], "•")
|
69 |
+
if isinstance(value, (int, float)):
|
70 |
+
value = f"{value:,}" # Add thousand separators
|
71 |
+
lines.append(f"{prefix} {icon} {str(key):<{max_key_length}}: {value}")
|
72 |
+
|
73 |
+
return lines
|
74 |
+
|
75 |
+
@staticmethod
|
76 |
+
def progress_bar(current: int, total: int, width: int = 20) -> str:
|
77 |
+
"""Create a progress bar"""
|
78 |
+
percentage = (current * 100) // total
|
79 |
+
filled = "█" * (percentage * width // 100)
|
80 |
+
empty = "░" * (width - len(filled))
|
81 |
+
return f"{filled}{empty} {percentage:3d}%"
|
82 |
+
|
83 |
+
@staticmethod
|
84 |
+
def error(message: str, error: Optional[Exception] = None) -> str:
|
85 |
+
"""Format error message"""
|
86 |
+
error_msg = f"\n❌ Error: {message}"
|
87 |
+
if error:
|
88 |
+
error_msg += f"\n └── Details: {str(error)}"
|
89 |
+
return error_msg
|
90 |
+
|
91 |
+
@staticmethod
|
92 |
+
def success(message: str) -> str:
|
93 |
+
"""Format success message"""
|
94 |
+
return f"✅ {message}"
|
95 |
+
|
96 |
+
@staticmethod
|
97 |
+
def warning(message: str) -> str:
|
98 |
+
"""Format warning message"""
|
99 |
+
return f"⚠️ {message}"
|
100 |
+
|
101 |
+
@staticmethod
|
102 |
+
def info(message: str) -> str:
|
103 |
+
"""Format info message"""
|
104 |
+
return f"ℹ️ {message}"
|
backend/app/services/hf_service.py
CHANGED
@@ -2,7 +2,7 @@ from typing import Optional
|
|
2 |
from huggingface_hub import HfApi
|
3 |
from app.config import HF_TOKEN, API
|
4 |
from app.core.cache import cache_config
|
5 |
-
from app.
|
6 |
import logging
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
|
|
2 |
from huggingface_hub import HfApi
|
3 |
from app.config import HF_TOKEN, API
|
4 |
from app.core.cache import cache_config
|
5 |
+
from app.core.formatting import LogFormatter
|
6 |
import logging
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
backend/app/services/leaderboard.py
CHANGED
@@ -5,7 +5,7 @@ import datasets
|
|
5 |
from fastapi import HTTPException
|
6 |
import logging
|
7 |
from app.config.base import HF_ORGANIZATION
|
8 |
-
from app.
|
9 |
|
10 |
logger = logging.getLogger(__name__)
|
11 |
|
@@ -143,7 +143,7 @@ class LeaderboardService:
|
|
143 |
"is_merged": data.get("Merged", False),
|
144 |
"is_moe": data.get("MoE", False),
|
145 |
"is_flagged": data.get("Flagged", False),
|
146 |
-
"
|
147 |
}
|
148 |
|
149 |
metadata = {
|
|
|
5 |
from fastapi import HTTPException
|
6 |
import logging
|
7 |
from app.config.base import HF_ORGANIZATION
|
8 |
+
from app.core.formatting import LogFormatter
|
9 |
|
10 |
logger = logging.getLogger(__name__)
|
11 |
|
|
|
143 |
"is_merged": data.get("Merged", False),
|
144 |
"is_moe": data.get("MoE", False),
|
145 |
"is_flagged": data.get("Flagged", False),
|
146 |
+
"is_official_provider": data.get("Official Providers", False)
|
147 |
}
|
148 |
|
149 |
metadata = {
|
backend/app/services/models.py
CHANGED
@@ -25,7 +25,7 @@ from app.services.hf_service import HuggingFaceService
|
|
25 |
from app.utils.model_validation import ModelValidator
|
26 |
from app.services.votes import VoteService
|
27 |
from app.core.cache import cache_config
|
28 |
-
from app.
|
29 |
|
30 |
# Disable datasets progress bars globally
|
31 |
disable_progress_bar()
|
@@ -409,6 +409,14 @@ class ModelService(HuggingFaceService):
|
|
409 |
logger.info(LogFormatter.subsection("CHECKING EXISTING SUBMISSIONS"))
|
410 |
existing_models = await self.get_models()
|
411 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
# Check in all statuses (pending, evaluating, finished)
|
413 |
for status, models in existing_models.items():
|
414 |
for model in models:
|
|
|
25 |
from app.utils.model_validation import ModelValidator
|
26 |
from app.services.votes import VoteService
|
27 |
from app.core.cache import cache_config
|
28 |
+
from app.core.formatting import LogFormatter
|
29 |
|
30 |
# Disable datasets progress bars globally
|
31 |
disable_progress_bar()
|
|
|
409 |
logger.info(LogFormatter.subsection("CHECKING EXISTING SUBMISSIONS"))
|
410 |
existing_models = await self.get_models()
|
411 |
|
412 |
+
# Call the official provider status check
|
413 |
+
is_valid, error_message = await self.validator.check_official_provider_status(
|
414 |
+
model_data["model_id"],
|
415 |
+
existing_models
|
416 |
+
)
|
417 |
+
if not is_valid:
|
418 |
+
raise ValueError(error_message)
|
419 |
+
|
420 |
# Check in all statuses (pending, evaluating, finished)
|
421 |
for status, models in existing_models.items():
|
422 |
for model in models:
|
backend/app/services/votes.py
CHANGED
@@ -4,16 +4,15 @@ import json
|
|
4 |
import logging
|
5 |
import asyncio
|
6 |
from pathlib import Path
|
7 |
-
import os
|
8 |
import aiohttp
|
9 |
from huggingface_hub import HfApi
|
10 |
import datasets
|
11 |
|
12 |
from app.services.hf_service import HuggingFaceService
|
13 |
-
from app.config import HF_TOKEN
|
14 |
from app.config.hf_config import HF_ORGANIZATION
|
15 |
from app.core.cache import cache_config
|
16 |
-
from app.
|
17 |
|
18 |
logger = logging.getLogger(__name__)
|
19 |
|
|
|
4 |
import logging
|
5 |
import asyncio
|
6 |
from pathlib import Path
|
|
|
7 |
import aiohttp
|
8 |
from huggingface_hub import HfApi
|
9 |
import datasets
|
10 |
|
11 |
from app.services.hf_service import HuggingFaceService
|
12 |
+
from app.config import HF_TOKEN
|
13 |
from app.config.hf_config import HF_ORGANIZATION
|
14 |
from app.core.cache import cache_config
|
15 |
+
from app.core.formatting import LogFormatter
|
16 |
|
17 |
logger = logging.getLogger(__name__)
|
18 |
|
backend/app/utils/logging.py
CHANGED
@@ -1,105 +1,3 @@
|
|
1 |
-
import
|
2 |
-
import sys
|
3 |
-
from typing import Dict, Any, List, Optional
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
class LogFormatter:
|
8 |
-
"""Utility class for consistent log formatting across the application"""
|
9 |
-
|
10 |
-
@staticmethod
|
11 |
-
def section(title: str) -> str:
|
12 |
-
"""Create a section header"""
|
13 |
-
return f"\n{'='*20} {title.upper()} {'='*20}"
|
14 |
-
|
15 |
-
@staticmethod
|
16 |
-
def subsection(title: str) -> str:
|
17 |
-
"""Create a subsection header"""
|
18 |
-
return f"\n{'─'*20} {title} {'─'*20}"
|
19 |
-
|
20 |
-
@staticmethod
|
21 |
-
def tree(items: Dict[str, Any], title: str = None) -> List[str]:
|
22 |
-
"""Create a tree view of dictionary data"""
|
23 |
-
lines = []
|
24 |
-
if title:
|
25 |
-
lines.append(f"📊 {title}:")
|
26 |
-
|
27 |
-
# Get the maximum length for alignment
|
28 |
-
max_key_length = max(len(str(k)) for k in items.keys())
|
29 |
-
|
30 |
-
# Format each item
|
31 |
-
for i, (key, value) in enumerate(items.items()):
|
32 |
-
prefix = "└──" if i == len(items) - 1 else "├──"
|
33 |
-
if isinstance(value, (int, float)):
|
34 |
-
value = f"{value:,}" # Add thousand separators
|
35 |
-
lines.append(f"{prefix} {str(key):<{max_key_length}}: {value}")
|
36 |
-
|
37 |
-
return lines
|
38 |
-
|
39 |
-
@staticmethod
|
40 |
-
def stats(stats: Dict[str, int], title: str = None) -> List[str]:
|
41 |
-
"""Format statistics with icons"""
|
42 |
-
lines = []
|
43 |
-
if title:
|
44 |
-
lines.append(f"📊 {title}:")
|
45 |
-
|
46 |
-
# Get the maximum length for alignment
|
47 |
-
max_key_length = max(len(str(k)) for k in stats.keys())
|
48 |
-
|
49 |
-
# Format each stat with an appropriate icon
|
50 |
-
icons = {
|
51 |
-
"total": "📌",
|
52 |
-
"success": "✅",
|
53 |
-
"error": "❌",
|
54 |
-
"pending": "⏳",
|
55 |
-
"processing": "⚙️",
|
56 |
-
"finished": "✨",
|
57 |
-
"evaluating": "🔄",
|
58 |
-
"downloads": "⬇️",
|
59 |
-
"files": "📁",
|
60 |
-
"cached": "💾",
|
61 |
-
"size": "📏",
|
62 |
-
"time": "⏱️",
|
63 |
-
"rate": "🚀"
|
64 |
-
}
|
65 |
-
|
66 |
-
# Format each item
|
67 |
-
for i, (key, value) in enumerate(stats.items()):
|
68 |
-
prefix = "└──" if i == len(stats) - 1 else "├──"
|
69 |
-
icon = icons.get(key.lower().split('_')[0], "•")
|
70 |
-
if isinstance(value, (int, float)):
|
71 |
-
value = f"{value:,}" # Add thousand separators
|
72 |
-
lines.append(f"{prefix} {icon} {str(key):<{max_key_length}}: {value}")
|
73 |
-
|
74 |
-
return lines
|
75 |
-
|
76 |
-
@staticmethod
|
77 |
-
def progress_bar(current: int, total: int, width: int = 20) -> str:
|
78 |
-
"""Create a progress bar"""
|
79 |
-
percentage = (current * 100) // total
|
80 |
-
filled = "█" * (percentage * width // 100)
|
81 |
-
empty = "░" * (width - len(filled))
|
82 |
-
return f"{filled}{empty} {percentage:3d}%"
|
83 |
-
|
84 |
-
@staticmethod
|
85 |
-
def error(message: str, error: Optional[Exception] = None) -> str:
|
86 |
-
"""Format error message"""
|
87 |
-
error_msg = f"\n❌ Error: {message}"
|
88 |
-
if error:
|
89 |
-
error_msg += f"\n └── Details: {str(error)}"
|
90 |
-
return error_msg
|
91 |
-
|
92 |
-
@staticmethod
|
93 |
-
def success(message: str) -> str:
|
94 |
-
"""Format success message"""
|
95 |
-
return f"✅ {message}"
|
96 |
-
|
97 |
-
@staticmethod
|
98 |
-
def warning(message: str) -> str:
|
99 |
-
"""Format warning message"""
|
100 |
-
return f"⚠️ {message}"
|
101 |
-
|
102 |
-
@staticmethod
|
103 |
-
def info(message: str) -> str:
|
104 |
-
"""Format info message"""
|
105 |
-
return f"ℹ️ {message}"
|
|
|
1 |
+
from app.core.formatting import LogFormatter
|
|
|
|
|
2 |
|
3 |
+
__all__ = ['LogFormatter']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backend/app/utils/model_validation.py
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
import json
|
2 |
import logging
|
3 |
import asyncio
|
4 |
-
import re
|
5 |
from typing import Tuple, Optional, Dict, Any
|
6 |
-
import
|
7 |
from huggingface_hub import HfApi, ModelCard, hf_hub_download
|
8 |
from huggingface_hub import hf_api
|
9 |
from transformers import AutoConfig, AutoTokenizer
|
10 |
-
from app.config.base import HF_TOKEN
|
11 |
-
from app.
|
12 |
-
|
13 |
|
14 |
logger = logging.getLogger(__name__)
|
15 |
|
@@ -207,4 +206,61 @@ class ModelValidator:
|
|
207 |
except Exception as e:
|
208 |
if "You are trying to access a gated repo." in str(e):
|
209 |
return True, "The model is gated and requires special access permissions.", None
|
210 |
-
return False, f"The model was not found or is misconfigured on the Hub. Error: {e.args[0]}", None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import json
|
2 |
import logging
|
3 |
import asyncio
|
|
|
4 |
from typing import Tuple, Optional, Dict, Any
|
5 |
+
from datasets import load_dataset
|
6 |
from huggingface_hub import HfApi, ModelCard, hf_hub_download
|
7 |
from huggingface_hub import hf_api
|
8 |
from transformers import AutoConfig, AutoTokenizer
|
9 |
+
from app.config.base import HF_TOKEN
|
10 |
+
from app.config.hf_config import OFFICIAL_PROVIDERS_REPO
|
11 |
+
from app.core.formatting import LogFormatter
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
|
|
206 |
except Exception as e:
|
207 |
if "You are trying to access a gated repo." in str(e):
|
208 |
return True, "The model is gated and requires special access permissions.", None
|
209 |
+
return False, f"The model was not found or is misconfigured on the Hub. Error: {e.args[0]}", None
|
210 |
+
|
211 |
+
async def check_official_provider_status(
|
212 |
+
self,
|
213 |
+
model_id: str,
|
214 |
+
existing_models: Dict[str, list]
|
215 |
+
) -> Tuple[bool, Optional[str]]:
|
216 |
+
"""
|
217 |
+
Check if model is from official provider and has finished submission.
|
218 |
+
|
219 |
+
Args:
|
220 |
+
model_id: The model identifier (org/model-name)
|
221 |
+
existing_models: Dictionary of models by status from get_models()
|
222 |
+
|
223 |
+
Returns:
|
224 |
+
Tuple[bool, Optional[str]]: (is_valid, error_message)
|
225 |
+
"""
|
226 |
+
try:
|
227 |
+
logger.info(LogFormatter.info(f"Checking official provider status for {model_id}"))
|
228 |
+
|
229 |
+
# Get model organization
|
230 |
+
model_org = model_id.split('/')[0] if '/' in model_id else None
|
231 |
+
|
232 |
+
if not model_org:
|
233 |
+
return True, None
|
234 |
+
|
235 |
+
# Load official providers dataset
|
236 |
+
dataset = load_dataset(OFFICIAL_PROVIDERS_REPO)
|
237 |
+
official_providers = dataset["train"][0]["CURATED_SET"]
|
238 |
+
|
239 |
+
# Check if model org is in official providers
|
240 |
+
is_official = model_org in official_providers
|
241 |
+
|
242 |
+
if is_official:
|
243 |
+
logger.info(LogFormatter.info(f"Model organization '{model_org}' is an official provider"))
|
244 |
+
|
245 |
+
# Check for finished submissions
|
246 |
+
if "finished" in existing_models:
|
247 |
+
for model in existing_models["finished"]:
|
248 |
+
if model["name"] == model_id:
|
249 |
+
error_msg = (
|
250 |
+
f"Model {model_id} is an official provider model "
|
251 |
+
f"with a completed evaluation. "
|
252 |
+
f"To re-evaluate, please open a discussion."
|
253 |
+
)
|
254 |
+
logger.error(LogFormatter.error("Validation failed", error_msg))
|
255 |
+
return False, error_msg
|
256 |
+
|
257 |
+
logger.info(LogFormatter.success("No finished submission found for this official provider model"))
|
258 |
+
else:
|
259 |
+
logger.info(LogFormatter.info(f"Model organization '{model_org}' is not an official provider"))
|
260 |
+
|
261 |
+
return True, None
|
262 |
+
|
263 |
+
except Exception as e:
|
264 |
+
error_msg = f"Failed to check official provider status: {str(e)}"
|
265 |
+
logger.error(LogFormatter.error(error_msg))
|
266 |
+
return False, error_msg
|
backend/pyproject.toml
CHANGED
@@ -13,8 +13,8 @@ pandas = "^2.2.3"
|
|
13 |
datasets = "^3.2.0"
|
14 |
pyarrow = "^18.1.0"
|
15 |
python-multipart = "^0.0.20"
|
16 |
-
huggingface-hub = "^0.27.
|
17 |
-
transformers = "^4.47.
|
18 |
safetensors = "^0.4.5"
|
19 |
aiofiles = "^24.1.0"
|
20 |
fastapi-cache2 = "^0.2.1"
|
|
|
13 |
datasets = "^3.2.0"
|
14 |
pyarrow = "^18.1.0"
|
15 |
python-multipart = "^0.0.20"
|
16 |
+
huggingface-hub = "^0.27.1"
|
17 |
+
transformers = "^4.47.1"
|
18 |
safetensors = "^0.4.5"
|
19 |
aiofiles = "^24.1.0"
|
20 |
fastapi-cache2 = "^0.2.1"
|
backend/utils/analyze_prod_datasets.py
CHANGED
@@ -132,7 +132,7 @@ def main():
|
|
132 |
"description": "User votes"
|
133 |
},
|
134 |
{
|
135 |
-
"id": f"{HF_ORGANIZATION}/
|
136 |
"description": "Highlighted models"
|
137 |
}
|
138 |
]
|
|
|
132 |
"description": "User votes"
|
133 |
},
|
134 |
{
|
135 |
+
"id": f"{HF_ORGANIZATION}/official-providers",
|
136 |
"description": "Highlighted models"
|
137 |
}
|
138 |
]
|
backend/utils/fix_wrong_model_size.py
CHANGED
@@ -13,7 +13,7 @@ from datetime import datetime
|
|
13 |
from tqdm.auto import tqdm
|
14 |
from tqdm.contrib.logging import logging_redirect_tqdm
|
15 |
|
16 |
-
from app.config.hf_config import HF_TOKEN,
|
17 |
|
18 |
from app.utils.model_validation import ModelValidator
|
19 |
|
@@ -59,7 +59,7 @@ def write_json(repo_path, file, content):
|
|
59 |
|
60 |
|
61 |
def main():
|
62 |
-
requests_path = "/
|
63 |
start_date = "2024-12-09"
|
64 |
end_date = "2025-01-07"
|
65 |
|
|
|
13 |
from tqdm.auto import tqdm
|
14 |
from tqdm.contrib.logging import logging_redirect_tqdm
|
15 |
|
16 |
+
from app.config.hf_config import HF_TOKEN, API
|
17 |
|
18 |
from app.utils.model_validation import ModelValidator
|
19 |
|
|
|
59 |
|
60 |
|
61 |
def main():
|
62 |
+
requests_path = "/requests"
|
63 |
start_date = "2024-12-09"
|
64 |
end_date = "2025-01-07"
|
65 |
|
backend/utils/sync_datasets_locally.py
CHANGED
@@ -30,7 +30,7 @@ DATASET_NAMES = [
|
|
30 |
"results",
|
31 |
"requests",
|
32 |
"contents",
|
33 |
-
"
|
34 |
]
|
35 |
|
36 |
# Build list of datasets with their source and destination paths
|
|
|
30 |
"results",
|
31 |
"requests",
|
32 |
"contents",
|
33 |
+
"official-providers",
|
34 |
]
|
35 |
|
36 |
# Build list of datasets with their source and destination paths
|
frontend/src/pages/AddModelPage/components/ModelSubmissionForm/ModelSubmissionForm.js
CHANGED
@@ -411,7 +411,7 @@ function ModelSubmissionForm({ user, isAuthenticated }) {
|
|
411 |
placeholder="organization/model-name"
|
412 |
value={formData.modelName}
|
413 |
onChange={handleChange}
|
414 |
-
helperText="Example: meta-llama/Llama-2-
|
415 |
InputProps={{
|
416 |
endAdornment: (
|
417 |
<InfoIconWithTooltip tooltip={HELP_TEXTS.modelName} />
|
|
|
411 |
placeholder="organization/model-name"
|
412 |
value={formData.modelName}
|
413 |
onChange={handleChange}
|
414 |
+
helperText="Example: meta-llama/Llama-3.2-1B"
|
415 |
InputProps={{
|
416 |
endAdornment: (
|
417 |
<InfoIconWithTooltip tooltip={HELP_TEXTS.modelName} />
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/FilteredModelCount.js
CHANGED
@@ -19,7 +19,7 @@ const useModelCount = ({ totalCount, filteredCount, data, table, loading }) => {
|
|
19 |
};
|
20 |
}
|
21 |
const displayCount = isOfficialProviderActive
|
22 |
-
? officialOnlyCounts.
|
23 |
: totalCount;
|
24 |
|
25 |
// Calculate total number of pinned models
|
@@ -46,8 +46,8 @@ const useModelCount = ({ totalCount, filteredCount, data, table, loading }) => {
|
|
46 |
// Filter by official providers
|
47 |
if (filterConfig.isOfficialProviderActive) {
|
48 |
if (
|
49 |
-
!model.features?.
|
50 |
-
!model.metadata?.
|
51 |
) {
|
52 |
return false;
|
53 |
}
|
@@ -100,7 +100,7 @@ const useModelCount = ({ totalCount, filteredCount, data, table, loading }) => {
|
|
100 |
typeof filter === "object" ? filter.value : filter;
|
101 |
|
102 |
// Maintainer's Highlight keeps positive logic
|
103 |
-
if (filterValue === "
|
104 |
return model.features[filterValue];
|
105 |
}
|
106 |
|
@@ -134,7 +134,7 @@ const useModelCount = ({ totalCount, filteredCount, data, table, loading }) => {
|
|
134 |
data,
|
135 |
state.filters,
|
136 |
isOfficialProviderActive,
|
137 |
-
officialOnlyCounts.
|
138 |
]);
|
139 |
};
|
140 |
|
|
|
19 |
};
|
20 |
}
|
21 |
const displayCount = isOfficialProviderActive
|
22 |
+
? officialOnlyCounts.officialProviders
|
23 |
: totalCount;
|
24 |
|
25 |
// Calculate total number of pinned models
|
|
|
46 |
// Filter by official providers
|
47 |
if (filterConfig.isOfficialProviderActive) {
|
48 |
if (
|
49 |
+
!model.features?.is_official_provider &&
|
50 |
+
!model.metadata?.is_official_provider
|
51 |
) {
|
52 |
return false;
|
53 |
}
|
|
|
100 |
typeof filter === "object" ? filter.value : filter;
|
101 |
|
102 |
// Maintainer's Highlight keeps positive logic
|
103 |
+
if (filterValue === "is_official_provider") {
|
104 |
return model.features[filterValue];
|
105 |
}
|
106 |
|
|
|
134 |
data,
|
135 |
state.filters,
|
136 |
isOfficialProviderActive,
|
137 |
+
officialOnlyCounts.officialProviders,
|
138 |
]);
|
139 |
};
|
140 |
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/Filters.js
CHANGED
@@ -781,18 +781,18 @@ const LeaderboardFilters = ({
|
|
781 |
<FilterTag
|
782 |
label={filter.label}
|
783 |
checked={
|
784 |
-
filter.value === "
|
785 |
? isOfficialProviderActive
|
786 |
: selectedBooleanFilters.includes(filter.value)
|
787 |
}
|
788 |
onChange={
|
789 |
-
filter.value === "
|
790 |
? handleOfficialProviderToggle
|
791 |
: () => handleBooleanFilterToggle(filter.value)
|
792 |
}
|
793 |
count={
|
794 |
-
filter.value === "
|
795 |
-
? currentCounts.
|
796 |
: 0
|
797 |
}
|
798 |
showCheckbox={true}
|
@@ -815,7 +815,7 @@ const LeaderboardFilters = ({
|
|
815 |
borderRadius: "50%",
|
816 |
backgroundColor: (
|
817 |
filter.value ===
|
818 |
-
"
|
819 |
? isOfficialProviderActive
|
820 |
: selectedBooleanFilters.includes(
|
821 |
filter.value
|
@@ -826,7 +826,7 @@ const LeaderboardFilters = ({
|
|
826 |
}}
|
827 |
/>
|
828 |
{(
|
829 |
-
filter.value === "
|
830 |
? isOfficialProviderActive
|
831 |
: selectedBooleanFilters.includes(filter.value)
|
832 |
)
|
|
|
781 |
<FilterTag
|
782 |
label={filter.label}
|
783 |
checked={
|
784 |
+
filter.value === "is_official_provider"
|
785 |
? isOfficialProviderActive
|
786 |
: selectedBooleanFilters.includes(filter.value)
|
787 |
}
|
788 |
onChange={
|
789 |
+
filter.value === "is_official_provider"
|
790 |
? handleOfficialProviderToggle
|
791 |
: () => handleBooleanFilterToggle(filter.value)
|
792 |
}
|
793 |
count={
|
794 |
+
filter.value === "is_official_provider"
|
795 |
+
? currentCounts.officialProviders
|
796 |
: 0
|
797 |
}
|
798 |
showCheckbox={true}
|
|
|
815 |
borderRadius: "50%",
|
816 |
backgroundColor: (
|
817 |
filter.value ===
|
818 |
+
"is_official_provider"
|
819 |
? isOfficialProviderActive
|
820 |
: selectedBooleanFilters.includes(
|
821 |
filter.value
|
|
|
826 |
}}
|
827 |
/>
|
828 |
{(
|
829 |
+
filter.value === "is_official_provider"
|
830 |
? isOfficialProviderActive
|
831 |
: selectedBooleanFilters.includes(filter.value)
|
832 |
)
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/QuickFilters.js
CHANGED
@@ -206,7 +206,7 @@ const QuickFilters = ({ totalCount = 0, loading = false }) => {
|
|
206 |
label={officialProvidersPreset.label}
|
207 |
checked={isOfficialProviderActive}
|
208 |
onChange={handleOfficialProviderToggle}
|
209 |
-
count={currentCounts.
|
210 |
totalCount={totalCount}
|
211 |
showCheckbox={true}
|
212 |
variant="secondary"
|
|
|
206 |
label={officialProvidersPreset.label}
|
207 |
checked={isOfficialProviderActive}
|
208 |
onChange={handleOfficialProviderToggle}
|
209 |
+
count={currentCounts.officialProviders}
|
210 |
totalCount={totalCount}
|
211 |
showCheckbox={true}
|
212 |
variant="secondary"
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/hooks/useOfficialProvidersMode.js
CHANGED
@@ -23,7 +23,7 @@ export const useOfficialProvidersMode = () => {
|
|
23 |
|
24 |
const filters = searchParams.get("filters");
|
25 |
const isHighlighted =
|
26 |
-
filters?.includes("
|
27 |
|
28 |
// On initial load
|
29 |
if (isInitialLoadRef.current) {
|
@@ -33,7 +33,7 @@ export const useOfficialProvidersMode = () => {
|
|
33 |
if (isHighlighted && filters) {
|
34 |
const initialNormalFilters = filters
|
35 |
.split(",")
|
36 |
-
.filter((f) => f !== "
|
37 |
.filter(Boolean);
|
38 |
if (initialNormalFilters.length > 0) {
|
39 |
normalFiltersRef.current = initialNormalFilters.join(",");
|
@@ -70,7 +70,7 @@ export const useOfficialProvidersMode = () => {
|
|
70 |
const currentFiltersStr = searchParams.get("filters");
|
71 |
const currentFilters =
|
72 |
currentFiltersStr?.split(",").filter(Boolean) || [];
|
73 |
-
const highlightFilter = "
|
74 |
const newSearchParams = new URLSearchParams(searchParams);
|
75 |
|
76 |
if (currentFilters.includes(highlightFilter)) {
|
|
|
23 |
|
24 |
const filters = searchParams.get("filters");
|
25 |
const isHighlighted =
|
26 |
+
filters?.includes("is_official_provider") || false;
|
27 |
|
28 |
// On initial load
|
29 |
if (isInitialLoadRef.current) {
|
|
|
33 |
if (isHighlighted && filters) {
|
34 |
const initialNormalFilters = filters
|
35 |
.split(",")
|
36 |
+
.filter((f) => f !== "is_official_provider" && f !== "")
|
37 |
.filter(Boolean);
|
38 |
if (initialNormalFilters.length > 0) {
|
39 |
normalFiltersRef.current = initialNormalFilters.join(",");
|
|
|
70 |
const currentFiltersStr = searchParams.get("filters");
|
71 |
const currentFilters =
|
72 |
currentFiltersStr?.split(",").filter(Boolean) || [];
|
73 |
+
const highlightFilter = "is_official_provider";
|
74 |
const newSearchParams = new URLSearchParams(searchParams);
|
75 |
|
76 |
if (currentFilters.includes(highlightFilter)) {
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/constants/defaults.js
CHANGED
@@ -59,14 +59,14 @@ const FILTERS = {
|
|
59 |
hide: true,
|
60 |
},
|
61 |
{
|
62 |
-
value: "
|
63 |
label: "Only Official Providers",
|
64 |
hide: false,
|
65 |
},
|
66 |
],
|
67 |
HIGHLIGHT_OPTIONS: [
|
68 |
{
|
69 |
-
value: "
|
70 |
label: "Only Official Providers",
|
71 |
},
|
72 |
],
|
@@ -237,7 +237,7 @@ const COLUMNS = {
|
|
237 |
defaultVisible: false,
|
238 |
label: "Hub Availability",
|
239 |
},
|
240 |
-
"features.
|
241 |
group: "additional_info",
|
242 |
size: COLUMN_SIZES.OFFICIAL_PROVIDER,
|
243 |
defaultVisible: false,
|
|
|
59 |
hide: true,
|
60 |
},
|
61 |
{
|
62 |
+
value: "is_official_provider",
|
63 |
label: "Only Official Providers",
|
64 |
hide: false,
|
65 |
},
|
66 |
],
|
67 |
HIGHLIGHT_OPTIONS: [
|
68 |
{
|
69 |
+
value: "is_official_provider",
|
70 |
label: "Only Official Providers",
|
71 |
},
|
72 |
],
|
|
|
237 |
defaultVisible: false,
|
238 |
label: "Hub Availability",
|
239 |
},
|
240 |
+
"features.is_official_provider": {
|
241 |
group: "additional_info",
|
242 |
size: COLUMN_SIZES.OFFICIAL_PROVIDER,
|
243 |
defaultVisible: false,
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/constants/quickFilters.js
CHANGED
@@ -45,7 +45,7 @@ export const QUICK_FILTER_PRESETS = [
|
|
45 |
shortDescription: 'Officially provided models',
|
46 |
description: 'Models that are officially provided and maintained by official creators or organizations.',
|
47 |
filters: {
|
48 |
-
selectedBooleanFilters: ['
|
49 |
}
|
50 |
}
|
51 |
];
|
|
|
45 |
shortDescription: 'Officially provided models',
|
46 |
description: 'Models that are officially provided and maintained by official creators or organizations.',
|
47 |
filters: {
|
48 |
+
selectedBooleanFilters: ['is_official_provider']
|
49 |
}
|
50 |
}
|
51 |
];
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext.js
CHANGED
@@ -47,7 +47,7 @@ const createInitialCounts = () => {
|
|
47 |
return {
|
48 |
modelTypes,
|
49 |
precisions,
|
50 |
-
|
51 |
mixtureOfExperts: 0,
|
52 |
flagged: 0,
|
53 |
merged: 0,
|
@@ -129,7 +129,7 @@ const modelMatchesFilters = (model, filters) => {
|
|
129 |
const filterValue = typeof filter === "object" ? filter.value : filter;
|
130 |
|
131 |
// Maintainer's Highlight keeps positive logic
|
132 |
-
if (filterValue === "
|
133 |
return model.features[filterValue];
|
134 |
}
|
135 |
|
@@ -187,8 +187,8 @@ const calculateModelCounts = (models) => {
|
|
187 |
|
188 |
models.forEach((model) => {
|
189 |
const isOfficial =
|
190 |
-
model.features?.
|
191 |
-
model.metadata?.
|
192 |
const countsToUpdate = [normalCounts];
|
193 |
|
194 |
if (isOfficial) {
|
@@ -214,10 +214,10 @@ const calculateModelCounts = (models) => {
|
|
214 |
|
215 |
// Boolean filters
|
216 |
if (
|
217 |
-
model.features?.
|
218 |
-
model.metadata?.
|
219 |
)
|
220 |
-
counts.
|
221 |
if (model.features?.is_moe || model.metadata?.is_moe)
|
222 |
counts.mixtureOfExperts++;
|
223 |
if (model.features?.is_flagged || model.metadata?.is_flagged)
|
|
|
47 |
return {
|
48 |
modelTypes,
|
49 |
precisions,
|
50 |
+
officialProviders: 0,
|
51 |
mixtureOfExperts: 0,
|
52 |
flagged: 0,
|
53 |
merged: 0,
|
|
|
129 |
const filterValue = typeof filter === "object" ? filter.value : filter;
|
130 |
|
131 |
// Maintainer's Highlight keeps positive logic
|
132 |
+
if (filterValue === "is_official_provider") {
|
133 |
return model.features[filterValue];
|
134 |
}
|
135 |
|
|
|
187 |
|
188 |
models.forEach((model) => {
|
189 |
const isOfficial =
|
190 |
+
model.features?.is_official_provider ||
|
191 |
+
model.metadata?.is_official_provider;
|
192 |
const countsToUpdate = [normalCounts];
|
193 |
|
194 |
if (isOfficial) {
|
|
|
214 |
|
215 |
// Boolean filters
|
216 |
if (
|
217 |
+
model.features?.is_official_provider ||
|
218 |
+
model.metadata?.is_official_provider
|
219 |
)
|
220 |
+
counts.officialProviders++;
|
221 |
if (model.features?.is_moe || model.metadata?.is_moe)
|
222 |
counts.mixtureOfExperts++;
|
223 |
if (model.features?.is_flagged || model.metadata?.is_flagged)
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useDataUtils.js
CHANGED
@@ -58,8 +58,8 @@ export const useProcessedData = (data, averageMode, visibleColumns) => {
|
|
58 |
...item.features,
|
59 |
is_moe: Boolean(item.features.is_moe),
|
60 |
is_flagged: Boolean(item.features.is_flagged),
|
61 |
-
|
62 |
-
item.features.
|
63 |
),
|
64 |
is_merged: Boolean(item.features.is_merged),
|
65 |
is_not_available_on_hub: Boolean(item.features.is_not_available_on_hub),
|
@@ -117,8 +117,8 @@ export const useFilteredData = (
|
|
117 |
if (isOfficialProviderActive) {
|
118 |
filteredUnpinned = filteredUnpinned.filter(
|
119 |
(row) =>
|
120 |
-
row.features?.
|
121 |
-
row.metadata?.
|
122 |
);
|
123 |
}
|
124 |
|
@@ -197,7 +197,7 @@ export const useFilteredData = (
|
|
197 |
typeof filter === "object" ? filter.value : filter;
|
198 |
|
199 |
// Maintainer's Highlight keeps positive logic
|
200 |
-
if (filterValue === "
|
201 |
return row.features[filterValue];
|
202 |
}
|
203 |
|
|
|
58 |
...item.features,
|
59 |
is_moe: Boolean(item.features.is_moe),
|
60 |
is_flagged: Boolean(item.features.is_flagged),
|
61 |
+
is_official_provider: Boolean(
|
62 |
+
item.features.is_official_provider
|
63 |
),
|
64 |
is_merged: Boolean(item.features.is_merged),
|
65 |
is_not_available_on_hub: Boolean(item.features.is_not_available_on_hub),
|
|
|
117 |
if (isOfficialProviderActive) {
|
118 |
filteredUnpinned = filteredUnpinned.filter(
|
119 |
(row) =>
|
120 |
+
row.features?.is_official_provider ||
|
121 |
+
row.metadata?.is_official_provider
|
122 |
);
|
123 |
}
|
124 |
|
|
|
197 |
typeof filter === "object" ? filter.value : filter;
|
198 |
|
199 |
// Maintainer's Highlight keeps positive logic
|
200 |
+
if (filterValue === "is_official_provider") {
|
201 |
return row.features[filterValue];
|
202 |
}
|
203 |
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/utils/columnUtils.js
CHANGED
@@ -1003,18 +1003,18 @@ export const createColumns = (
|
|
1003 |
],
|
1004 |
},
|
1005 |
{
|
1006 |
-
accessorKey: "features.
|
1007 |
header: createHeaderCell(
|
1008 |
"Official Providers",
|
1009 |
"Models that are officially provided and maintained by their original creators or organizations"
|
1010 |
),
|
1011 |
cell: ({ row }) => (
|
1012 |
<BooleanValue
|
1013 |
-
value={row.original.features.
|
1014 |
/>
|
1015 |
),
|
1016 |
size: TABLE_DEFAULTS.COLUMNS.COLUMN_SIZES[
|
1017 |
-
"features.
|
1018 |
],
|
1019 |
enableSorting: true,
|
1020 |
},
|
@@ -1061,7 +1061,7 @@ export const createColumns = (
|
|
1061 |
"metadata.base_model": 10,
|
1062 |
"model.has_chat_template": 11,
|
1063 |
"features.is_not_available_on_hub": 12,
|
1064 |
-
"features.
|
1065 |
"features.is_moe": 14,
|
1066 |
"features.is_flagged": 15,
|
1067 |
};
|
|
|
1003 |
],
|
1004 |
},
|
1005 |
{
|
1006 |
+
accessorKey: "features.is_official_provider",
|
1007 |
header: createHeaderCell(
|
1008 |
"Official Providers",
|
1009 |
"Models that are officially provided and maintained by their original creators or organizations"
|
1010 |
),
|
1011 |
cell: ({ row }) => (
|
1012 |
<BooleanValue
|
1013 |
+
value={row.original.features.is_official_provider}
|
1014 |
/>
|
1015 |
),
|
1016 |
size: TABLE_DEFAULTS.COLUMNS.COLUMN_SIZES[
|
1017 |
+
"features.is_official_provider"
|
1018 |
],
|
1019 |
enableSorting: true,
|
1020 |
},
|
|
|
1061 |
"metadata.base_model": 10,
|
1062 |
"model.has_chat_template": 11,
|
1063 |
"features.is_not_available_on_hub": 12,
|
1064 |
+
"features.is_official_provider": 13,
|
1065 |
"features.is_moe": 14,
|
1066 |
"features.is_flagged": 15,
|
1067 |
};
|