File size: 832 Bytes
ad8e780
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import re
import requests
from enum import Enum
from dataclasses import dataclass


@dataclass
class ModelInfo:
    name: str
    symbol: str  # emoji


class ModelType(Enum):
    PT = ModelInfo(name="pretrained", symbol="🟒")
    FT = ModelInfo(name="fine-tuned", symbol="πŸ”Ά")
    IFT = ModelInfo(name="instruction-tuned", symbol="β­•")
    RL = ModelInfo(name="RL-tuned", symbol="🟦")
    Unknown = ModelInfo(name="Unknown, add type to request file!", symbol="❓")

    def to_str(self, separator=" "):
        return f"{self.value.symbol}{separator}{self.value.name}"


text = requests.get(
    "https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard/raw/main/src/display_models/model_metadata_type.py"
).text

dicts = re.findall(r"\{.*?\}", text, re.DOTALL)

MODEL_TYPES = eval(max(dicts, key=len))
MODEL_TYPES