Spaces:
Running
Running
File size: 2,670 Bytes
fe8ec74 3b3db42 8b1f7a0 c85dcc4 fe8ec74 8b1f7a0 fe8ec74 01ea22b 0df3db8 8b1f7a0 fe8ec74 c85dcc4 fe8ec74 c85dcc4 bd30e41 fe8ec74 d66a6a3 fe8ec74 c85dcc4 fe8ec74 d66a6a3 c85dcc4 fe8ec74 d66a6a3 c85dcc4 fe8ec74 c85dcc4 fe8ec74 d66a6a3 c2c3c10 fe8ec74 d66a6a3 c2c3c10 fe8ec74 d66a6a3 c2c3c10 8b1f7a0 fe8ec74 c2c3c10 29efd58 13edd99 480ac67 13edd99 8b1f7a0 d66a6a3 c85dcc4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
from functools import cached_property
from pathlib import Path
from typing import Annotated
from huggingface_hub import HfApi
from pydantic import Field, SecretStr, computed_field
from pydantic_settings import BaseSettings, SettingsConfigDict
# ----------------------------------
# Info to change for your repository
# ----------------------------------
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env")
HF_TOKEN: Annotated[SecretStr, Field(..., description="A read/write token for your org")]
# Settings for Hugging Face repos
HF_OWNER: str = "lmms-lab"
HF_REPO_NAME: Annotated[str, Field(description="Name of leaderboard repo")] = "EASI-Leaderboard"
HF_RESULTS_REPO_NAME: Annotated[str, Field(description="Name of results repo")] = "EASI-Leaderboard-Results"
HF_REQUESTS_REPO_NAME: Annotated[str, Field(description="Name of requests repo")] = "EASI-Leaderboard-Requests"
@computed_field
@cached_property
def REPO_ID(self) -> str:
return (Path(self.HF_OWNER) / self.HF_REPO_NAME).as_posix()
@computed_field
@cached_property
def RESULTS_REPO_ID(self) -> str:
return (Path(self.HF_OWNER) / self.HF_RESULTS_REPO_NAME).as_posix()
@computed_field
@cached_property
def QUEUE_REPO_ID(self) -> str:
return (Path(self.HF_OWNER) / self.HF_REQUESTS_REPO_NAME).as_posix()
HF_HOME: Annotated[
Path,
Field(
default_factory=lambda: Path(".").resolve(),
description="If you setup a cache later, just change `HF_HOME`",
),
]
# Backend settings
BACKEND_HOST: Annotated[str, Field("127.0.0.1", description="Backend host")]
BACKEND_PORT: Annotated[int, Field(8000, description="Backend port")]
# Local caches
@computed_field
@cached_property
def EVAL_REQUESTS_PATH(self) -> Path:
return self.HF_HOME / "eval-queue"
@computed_field
@cached_property
def EVAL_RESULTS_PATH(self) -> Path:
return self.HF_HOME / "eval-results"
@computed_field
@cached_property
def EVAL_RESULTS_VERSIONS_DIR(self) -> Path:
return self.EVAL_RESULTS_PATH / "leaderboard/versions"
@computed_field
@cached_property
def EVAL_REQUESTS_PATH_BACKUP(self) -> Path:
return self.HF_HOME / "eval-queue-bk"
@computed_field
@cached_property
def EVAL_RESULTS_PATH_BACKUP(self) -> Path:
return self.HF_HOME / "eval-results-bk"
ENABLE_BENCHMARK_TABS: bool = False
ENABLE_SUBMISSION: bool = True
settings = Settings() # pyright: ignore[reportCallIssue]
API = HfApi(token=settings.HF_TOKEN.get_secret_value())
|