kenchenxingyu
commited on
Commit
•
c309ad3
1
Parent(s):
d235877
Update README.md
Browse files
README.md
CHANGED
@@ -88,12 +88,67 @@ Use the code below to get started with the model.
|
|
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. -->
|
|
|
88 |
#### Preprocessing [optional]
|
89 |
|
90 |
[More Information Needed]
|
91 |
+
train_df['emotion_stance'] = "Classify based on the features:" + train_df['target_emotion_stance'].apply(lambda x: str(x)) + " in the text: " + train_df['source_text']
|
92 |
+
train_df['emotion'] = "Classify based on the features:" + train_df['target_emotion'].apply(lambda x: str(x)) + " in the text: " + train_df['source_text']
|
93 |
+
train_df['stance'] = "Classify based on the features:" + train_df['target_stance'].apply(lambda x: str(x)) + " in the text: " + train_df['source_text']
|
94 |
+
|
95 |
+
test_df['emotion_stance'] = "Classify based on the features:" + test_df['target_emotion_stance'].apply(lambda x: str(x)) + " in the text: " + test_df['source_text']
|
96 |
+
test_df['emotion'] = "Classify based on the features:" + test_df['target_emotion'].apply(lambda x: str(x)) + " in the text: " + test_df['source_text']
|
97 |
+
test_df['stance'] = "Classify based on the features:" + test_df['target_stance'].apply(lambda x: str(x)) + " in the text: " + test_df['source_text']
|
98 |
+
|
99 |
+
val_df['emotion_stance'] = "Classify based on the features:" + val_df['target_emotion_stance'].apply(lambda x: str(x)) + " in the text: " + val_df['source_text']
|
100 |
+
val_df['emotion'] = "Classify based on the features:" + val_df['target_emotion'].apply(lambda x: str(x)) + " in the text: " + val_df['source_text']
|
101 |
+
val_df['stance'] = "Classify based on the features:" + val_df['target_stance'].apply(lambda x: str(x)) + " in the text: " + val_df['source_text']
|
102 |
+
|
103 |
+
#label_dict = {0:'FAKE', 1:'REAL'}
|
104 |
+
|
105 |
+
train_df['target_text'] = train_df['target_text'].apply(lambda x: str(x))
|
106 |
+
val_df['target_text'] = val_df['target_text'].apply(lambda x: str(x))
|
107 |
+
test_df['target_text'] = test_df['target_text'].apply(lambda x: str(x))
|
108 |
+
|
109 |
+
max_length = 500
|
110 |
+
|
111 |
+
train_df = train_df[['source_text', 'target_text', #'src', #'dict_target_emotion_stance',
|
112 |
+
'target_emotion_stance', 'target_emotion', 'target_stance',
|
113 |
+
'emotion_stance', 'emotion', 'stance']]
|
114 |
+
|
115 |
+
test_df = test_df[['source_text', 'target_text', #'src', #'dict_target_emotion_stance',
|
116 |
+
'target_emotion_stance', 'target_emotion', 'target_stance',
|
117 |
+
'emotion_stance', 'emotion', 'stance']]
|
118 |
+
|
119 |
+
val_df = val_df[['source_text', 'target_text', #'src', #'dict_target_emotion_stance',
|
120 |
+
'target_emotion_stance', 'target_emotion', 'target_stance',
|
121 |
+
'emotion_stance', 'emotion', 'stance']]
|
122 |
|
123 |
|
124 |
#### Training Hyperparameters
|
125 |
|
126 |
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
127 |
|
128 |
+
TrainingArguments(
|
129 |
+
output_dir="temp",
|
130 |
+
evaluation_strategy="epoch",
|
131 |
+
learning_rate=1e-3,
|
132 |
+
gradient_accumulation_steps=1,
|
133 |
+
#auto_find_batch_size=True,
|
134 |
+
num_train_epochs=2,
|
135 |
+
#save_steps=100,
|
136 |
+
weight_decay=0.01,
|
137 |
+
save_total_limit=2,
|
138 |
+
|
139 |
+
|
140 |
+
#optim="adafactor",
|
141 |
+
optim="adamw_torch_fused",
|
142 |
+
per_device_train_batch_size=128,
|
143 |
+
per_device_eval_batch_size=128,
|
144 |
+
|
145 |
+
# save_steps=1000,
|
146 |
+
# evaluation_strategy ="steps",
|
147 |
+
metric_for_best_model = 'eval_loss', #eval_loss
|
148 |
+
save_strategy="epoch",
|
149 |
+
load_best_model_at_end=True,
|
150 |
+
)
|
151 |
+
|
152 |
#### Speeds, Sizes, Times [optional]
|
153 |
|
154 |
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|