HoleEast979 commited on
Commit
0e3532a
·
verified ·
1 Parent(s): 547dd7a

完善ModelCard

Browse files
Files changed (1) hide show
  1. README.md +137 -39
README.md CHANGED
@@ -1,62 +1,160 @@
1
- ---
2
  library_name: transformers
3
  license: apache-2.0
4
  base_model: distilbert-base-uncased
5
  tags:
6
- - generated_from_trainer
 
 
 
 
 
 
 
7
  metrics:
8
- - accuracy
 
9
  model-index:
10
- - name: imdb-sentiment-distilbert
11
- results: []
12
- ---
13
 
14
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
- should probably proofread and complete it, then remove this comment. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- # imdb-sentiment-distilbert
18
 
19
- This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on an unknown dataset.
20
- It achieves the following results on the evaluation set:
21
- - Loss: 0.3455
22
- - Accuracy: 0.85
23
 
24
- ## Model description
25
 
26
- More information needed
27
 
28
- ## Intended uses & limitations
29
 
30
- More information needed
31
 
32
- ## Training and evaluation data
33
 
34
- More information needed
35
 
36
- ## Training procedure
37
 
38
- ### Training hyperparameters
39
 
40
- The following hyperparameters were used during training:
41
- - learning_rate: 2e-05
42
- - train_batch_size: 16
43
- - eval_batch_size: 16
44
- - seed: 42
45
- - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
46
- - lr_scheduler_type: linear
47
- - num_epochs: 2
48
 
49
- ### Training results
50
 
51
- | Training Loss | Epoch | Step | Validation Loss | Accuracy |
52
- |:-------------:|:-----:|:----:|:---------------:|:--------:|
53
- | No log | 1.0 | 63 | 0.4222 | 0.844 |
54
- | No log | 2.0 | 126 | 0.3455 | 0.85 |
55
 
 
56
 
57
- ### Framework versions
58
 
59
- - Transformers 4.56.0
60
- - Pytorch 2.8.0+cu126
61
- - Datasets 4.0.0
62
- - Tokenizers 0.22.0
 
1
+ 这部分是YAML元数据,Hugging Face会用它来分类和展示你的模型
2
  library_name: transformers
3
  license: apache-2.0
4
  base_model: distilbert-base-uncased
5
  tags:
6
+
7
+ sentiment-analysis # 任务标签
8
+
9
+ text-classification # 任务标签
10
+
11
+ imdb # 数据集标签
12
+
13
+ generated_from_trainer # 表明是使用Trainer训练的
14
  metrics:
15
+
16
+ accuracy
17
  model-index:
 
 
 
18
 
19
+ name: imdb-sentiment-distilbert
20
+ results:
21
+
22
+ task:
23
+ type: text-classification
24
+ dataset:
25
+ name: imdb
26
+ type: imdb
27
+ metrics:
28
+
29
+ name: Accuracy
30
+ type: accuracy
31
+ value: 0.85
32
+
33
+ 情感分析模型:distilbert-base-uncased-imdb
34
+ 这是一个基于 distilbert-base-uncased 模型,在经典的 IMDB 电影评论数据集 上进行微调的情感分析模型。它能够高效地判断一段英文文本所表达的情感是正面的还是负面的。
35
+
36
+ 🚀 模型性能
37
+ 该模型在 IMDB 数据集的评估集上取得了以下性能:
38
+
39
+ 指标 (Metric)
40
+
41
+ 数值 (Value)
42
+
43
+ 评估损失 (Loss)
44
+
45
+ 0.3455
46
+
47
+ 准确率 (Accuracy)
48
+
49
+ 0.85
50
+
51
+ 💡 如何使用
52
+ 您可以非常方便地使用 transformers 库中的 pipeline 来调用这个模型。
53
+
54
+ # 安装transformers库
55
+ # pip install transformers
56
+
57
+ from transformers import pipeline
58
+
59
+ # 使用您的模型仓库ID加载pipeline
60
+ # 请将 "YOUR_USERNAME/YOUR_REPO_NAME" 替换为您的模型地址
61
+ sentiment_pipeline = pipeline(
62
+ "sentiment-analysis",
63
+ model="YOUR_USERNAME/imdb-sentiment-distilbert"
64
+ )
65
+
66
+ # 测试正面评论
67
+ positive_comment = "This movie was absolutely fantastic, a masterpiece of modern cinema!"
68
+ result_pos = sentiment_pipeline(positive_comment)
69
+ print(f"评论: '{positive_comment}'")
70
+ print(f"情感分析结果: {result_pos}")
71
+ # 预期输出: [{'label': 'POSITIVE', 'score': ...}]
72
+
73
+ print("-" * 50)
74
+
75
+ # 测试负面评论
76
+ negative_comment = "I would not recommend this film, it was quite boring and a waste of time."
77
+ result_neg = sentiment_pipeline(negative_comment)
78
+ print(f"评论: '{negative_comment}'")
79
+ print(f"情感分析结果: {result_neg}")
80
+ # 预期输出: [{'label': 'NEGATIVE', 'score': ...}]
81
+
82
+ 📚 训练细节
83
+ 训练数据
84
+ 本模型使用了 imdb 数据集进行训练和评估。该数据集包含 50,000 条电影评论,其中 25,000 条用于训练,25,000 条用于测试。每条评论都被标记为 正面 (POSITIVE) 或 负面 (NEGATIVE)。为了快速完成项目,本次训练使用了其中的一小部分样本(1000条训练,1000条评估)。
85
+
86
+ 训练过程
87
+ 模型微调是基于 Hugging Face transformers 库的 Trainer API 完成的。
88
+
89
+ 超参数 (Hyperparameters)
90
+ 超参数
91
+
92
+
93
+
94
+ learning_rate
95
+
96
+ 2e-05
97
+
98
+ train_batch_size
99
+
100
+ 16
101
+
102
+ eval_batch_size
103
+
104
+ 16
105
+
106
+ seed
107
+
108
+ 42
109
+
110
+ optimizer
111
+
112
+ AdamW (betas=(0.9,0.999), epsilon=1e-08)
113
+
114
+ lr_scheduler_type
115
+
116
+ linear
117
+
118
+ num_epochs
119
+
120
+ 2
121
+
122
+ 训练结果日志
123
+ Training Loss
124
+
125
+ Epoch
126
+
127
+ Step
128
 
129
+ Validation Loss
130
 
131
+ Accuracy
 
 
 
132
 
133
+ No log
134
 
135
+ 1.0
136
 
137
+ 63
138
 
139
+ 0.4222
140
 
141
+ 0.844
142
 
143
+ No log
144
 
145
+ 2.0
146
 
147
+ 126
148
 
149
+ 0.3455
 
 
 
 
 
 
 
150
 
151
+ 0.85
152
 
153
+ 框架版本
154
+ Transformers: 4.56.0
 
 
155
 
156
+ Pytorch: 2.8.0+cu126
157
 
158
+ Datasets: 4.0.0
159
 
160
+ Tokenizers: 0.22.0