ACEEE1222 commited on
Commit
63f16ba
·
verified ·
1 Parent(s): b553627

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -132
README.md CHANGED
@@ -1,202 +1,141 @@
1
  ---
2
  base_model: fnlp/bart-large-chinese
3
  library_name: peft
 
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
 
 
11
 
12
  ## Model Details
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
-
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
 
 
35
 
36
  ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
  ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
 
52
  ### Out-of-Scope Use
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
 
58
  ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
 
64
  ### Recommendations
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
  ## How to Get Started with the Model
71
 
72
- Use the code below to get started with the model.
 
 
73
 
74
- [More Information Needed]
 
 
 
 
 
 
 
75
 
76
  ## Training Details
77
 
78
  ### Training Data
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
 
84
  ### Training Procedure
85
 
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
 
 
 
92
 
93
  #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
 
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
 
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
 
127
  ### Results
128
 
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
 
 
140
 
141
  ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
154
 
155
  ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
 
159
  ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
 
169
- [More Information Needed]
170
 
171
- ## Citation [optional]
 
 
 
 
 
 
 
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
200
- ### Framework versions
201
 
202
- - PEFT 0.11.1
 
 
1
  ---
2
  base_model: fnlp/bart-large-chinese
3
  library_name: peft
4
+ pipeline_tag: summarization
5
  ---
6
 
7
+ # Model Card for LoRA Fine-tuned Chinese BART
 
 
 
8
 
9
+ 这是一个基于 [`fnlp/bart-large-chinese`](https://huggingface.co/fnlp/bart-large-chinese) 模型进行 LoRA 微调的中文摘要模型,训练任务为中文新闻标题或摘要生成,适用于中文短文本压缩和提炼。
10
 
11
  ## Model Details
12
 
13
  ### Model Description
14
 
15
+ 本模型使用 PEFT 框架对 `fnlp/bart-large-chinese` 进行参数高效微调,采用了 LoRA(Low-Rank Adaptation)技术,仅调整注意力中的部分权重矩阵,使得训练过程更轻量。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ - **Developed by:** [Your Name or Organization]
18
+ - **Model type:** Seq2Seq(BART)
19
+ - **Language(s):** Chinese
20
+ - **License:** Same as base model (assumed Apache 2.0, verify if needed)
21
+ - **Finetuned from model:** fnlp/bart-large-chinese
22
 
23
  ## Uses
24
 
 
 
25
  ### Direct Use
26
 
27
+ 可用于中文摘要任务,如新闻标题生成、内容压缩等。
 
 
 
 
 
 
 
 
28
 
29
  ### Out-of-Scope Use
30
 
31
+ 不适用于多语言摘要、多文档总结或事实一致性要求极高的任务。
 
 
32
 
33
  ## Bias, Risks, and Limitations
34
 
35
+ 该模型基于公开中文数据集进行训练,可能在处理敏感内容、歧视性语言或特定社会群体时存在偏差。
 
 
36
 
37
  ### Recommendations
38
 
39
+ 建议仅在清洗干净的中文文本数据上使用该模型,避免用于决策支持或敏感领域。
 
 
40
 
41
  ## How to Get Started with the Model
42
 
43
+ ```python
44
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
45
+ from peft import PeftModel
46
 
47
+ base_model = AutoModelForSeq2SeqLM.from_pretrained("fnlp/bart-large-chinese")
48
+ peft_model = PeftModel.from_pretrained(base_model, "your-username/your-model-name")
49
+ tokenizer = AutoTokenizer.from_pretrained("fnlp/bart-large-chinese")
50
+
51
+ inputs = tokenizer("据报道,苹果将在下月发布新款iPhone。", return_tensors="pt")
52
+ summary_ids = peft_model.generate(**inputs, max_length=30)
53
+ print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))
54
+ ````
55
 
56
  ## Training Details
57
 
58
  ### Training Data
59
 
60
+ 微调数据来自预处理后的中文新闻摘要数据集(如LCSTS),分为训练集与验证集,并使用了 `datasets` 库保存和加载。
 
 
61
 
62
  ### Training Procedure
63
 
64
+ #### Preprocessing
 
 
 
 
65
 
66
+ * 使用 HuggingFace tokenizer 编码输入/输出文本
67
+ * 设置 `max_source_length` 和 `max_target_length`
68
 
69
  #### Training Hyperparameters
70
 
71
+ * **Epochs:** 4
72
+ * **Batch Size:** 64
73
+ * **Learning Rate:** 2e-5
74
+ * **Evaluation Steps:** 5000
75
+ * **Save Steps:** 10000
76
+ * **Precision:** fp16
77
+ * **LoRA Config:** r=8, alpha=16, dropout=0.1
78
+ * **Target Modules:** `q_proj`, `v_proj`
79
 
80
  ## Evaluation
81
 
82
+ ### Testing Data
 
 
 
 
 
 
 
 
83
 
84
+ 使用与训练集相同来源的 held-out 验证集。
85
 
86
+ ### Metrics
87
 
88
+ 使用 ROUGE-1 / ROUGE-2 / ROUGE-L 评估自动摘要质量,中文评估按“字”或“词”颗粒度使用 `jieba` 分词。
 
 
 
 
 
 
89
 
90
  ### Results
91
 
92
+ 示例结果:
 
 
 
 
 
 
93
 
94
+ | Metric | Score |
95
+ | ------- | ----- |
96
+ | ROUGE-1 | 0.35 |
97
+ | ROUGE-2 | 0.19 |
98
+ | ROUGE-L | 0.31 |
99
 
100
  ## Environmental Impact
101
 
102
+ * **Hardware Type:** NVIDIA A100 GPU
103
+ * **Hours used:** 2\~3 hours
104
+ * **Cloud Provider:** \[Optional: e.g., Azure / AWS / 自有服务器]
105
+ * **Compute Region:** \[Optional]
106
+ * **Carbon Emitted:** Estimated using [MLCO2 calculator](https://mlco2.github.io/impact#compute)
 
 
 
 
107
 
108
+ ## Technical Specifications
109
 
110
  ### Model Architecture and Objective
111
 
112
+ 基于 BART 的编码-解码结构,目标是最小化生成摘要与参考摘要之间的交叉熵损失。
113
 
114
  ### Compute Infrastructure
115
 
116
+ * **GPU:** NVIDIA A100 80GB
117
+ * **Software:** PyTorch, Transformers, PEFT, Datasets, jieba
 
 
 
 
 
118
 
119
+ ## Citation
120
 
121
+ ```bibtex
122
+ @misc{your2025bartlora,
123
+ title={LoRA Fine-tuned BART for Chinese Summarization},
124
+ author={Your Name},
125
+ year={2025},
126
+ howpublished={\url{https://huggingface.co/your-username/your-model-name}},
127
+ }
128
+ ```
129
 
130
+ ## Model Card Contact
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
+ * \[[your-email@example.com](mailto:your-email@example.com)]
133
 
134
+ ```
135
 
136
+ ---
137
 
138
+ 你可以根据需要替换 `"your-username/your-model-name"` 和 `"Your Name"` 以及邮箱等信息。
 
139
 
140
+ 如果你还需要我帮你生成 [上传脚本](f) 或 [README 生成器](f),可以告诉我。
141
+ ```