Files changed (1) hide show
  1. src/report.py +120 -0
src/report.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from enum import Enum
3
+ from pathlib import Path
4
+ @dataclass
5
+ class Task:
6
+ benchmark: str
7
+ metric: str
8
+ col_name: str
9
+ REPORT_MD_PATH = Path(__file__).parent.parent / "Files" / "report.md"
10
+ with open(REPORT_MD_PATH, "r", encoding="utf-8") as f:
11
+ REPORT_TEXT = f.read()
12
+
13
+ TITLE = "# LLM Benchmark Leaderboard"
14
+
15
+ # 替换LLM_BENCHMARKS_TEXT为report.md内容
16
+ LLM_BENCHMARKS_TEXT = REPORT_TEXT
17
+
18
+ CITATION_BUTTON_LABEL = "📖 Citation"
19
+ CITATION_BUTTON_TEXT = """If you use this benchmark, please cite: ...
20
+ (原citation内容保留)"""
21
+
22
+ EVALUATION_QUEUE_TEXT = "Models submitted for evaluation will appear here."
23
+
24
+
25
+ # Select your tasks here
26
+ # ---------------------------------------------------
27
+ class Tasks(Enum):
28
+ # task_key in the json file, metric_key in the json file, name to display in the leaderboard
29
+ task0 = Task("anli_r1", "acc", "ANLI")
30
+ task1 = Task("logiqa", "acc_norm", "LogiQA")
31
+
32
+ NUM_FEWSHOT = 0 # Change with your few shot
33
+ # ---------------------------------------------------
34
+
35
+
36
+
37
+ # Your leaderboard name
38
+ TITLE = """<h1 align="center" id="space-title">Demo leaderboard</h1>"""
39
+
40
+ # What does your leaderboard evaluate?
41
+ INTRODUCTION_TEXT = """
42
+ Intro text
43
+ """
44
+
45
+ # Which evaluations are you running? how can people reproduce what you have?
46
+ LLM_BENCHMARKS_TEXT = f"""
47
+ ## How it works
48
+
49
+ ## Reproducibility
50
+ To reproduce our results, here is the commands you can run:
51
+
52
+ """
53
+
54
+ EVALUATION_QUEUE_TEXT = """
55
+ ## Some good practices before submitting a model
56
+
57
+ ### 1) Make sure you can load your model and tokenizer using AutoClasses:
58
+ ```python
59
+ from transformers import AutoConfig, AutoModel, AutoTokenizer
60
+ config = AutoConfig.from_pretrained("your model name", revision=revision)
61
+ model = AutoModel.from_pretrained("your model name", revision=revision)
62
+ tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision)
63
+ ```
64
+ If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded.
65
+
66
+ Note: make sure your model is public!
67
+ Note: if your model needs `use_remote_code=True`, we do not support this option yet but we are working on adding it, stay posted!
68
+
69
+ ### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index)
70
+ It's a new format for storing weights which is safer and faster to load and use. It will also allow us to add the number of parameters of your model to the `Extended Viewer`!
71
+
72
+ ### 3) Make sure your model has an open license!
73
+ This is a leaderboard for Open LLMs, and we'd love for as many people as possible to know they can use your model 🤗
74
+
75
+ ### 4) Fill up your model card
76
+ When we add extra information about models to the leaderboard, it will be automatically taken from the model card
77
+
78
+ ## In case of model failure
79
+ If your model is displayed in the `FAILED` category, its execution stopped.
80
+ Make sure you have followed the above steps first.
81
+ If everything is done, check you can launch the EleutherAIHarness on your model locally, using the above command without modifications (you can add `--limit` to limit the number of examples per task).
82
+ """
83
+
84
+ CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
85
+ CITATION_BUTTON_TEXT = r"""
86
+ """
87
+ # Report
88
+
89
+ ## 1. 模型及类别选择
90
+
91
+ 本次实验选用了三类大模型:Llama 3, Mistral 7B, ChatGPT。
92
+
93
+ - **Llama 3**:开源社区广泛使用,适合中英文任务。
94
+ - **Mistral 7B**:轻量级,适合边缘设备。
95
+ - **ChatGPT**:闭源,适合通用对话任务,表现最优。
96
+
97
+ | 模型名称 | 参数量 | 开源情况 | 主要用途 |
98
+ |------------|--------|---------|----------------|
99
+ | Llama 3 | 70B | 是 | 多语言任务 |
100
+ | Mistral 7B | 7B | 是 | 低功耗推理任务 |
101
+ | ChatGPT | 未公开 | 否 | 通用对话、推理任务 |
102
+
103
+ **选择理由**:
104
+ - Llama 3和Mistral为开源,方便定制与修改;
105
+ - ChatGPT性能优越,作为基准。
106
+
107
+ ---
108
+
109
+ ## 2. 系统实现细节
110
+
111
+ ### Gradio交互界面截图
112
+ ![Gradio界面](./interface.png)
113
+
114
+ ### 输入与输出流程图
115
+ ```mermaid
116
+ graph TD
117
+ A[用户输入] --> B[Gradio界面]
118
+ B --> C[模型推理]
119
+ C --> D[返回结果]
120
+