File tree 4 files changed +24
-16
lines changed
4 files changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ def main():
175
175
count = 0
176
176
learning_rate = init_lr
177
177
acc_best = - 100
178
+ acc_best_true = - 100
178
179
adjust_rate_flag = False
179
180
stop_train = False
180
181
adjust_time = 0
@@ -216,8 +217,8 @@ def main():
216
217
op_state = copy .deepcopy (optimizer .state_dict ())
217
218
elif (acc > acc_best - end_adjust_acc ):
218
219
adjust_rate_count += 1
219
- if acc > acc_best and adjust_rate_count == 10 :
220
- acc_best = acc
220
+ if acc > acc_best and acc > acc_best_true :
221
+ acc_best_true = acc
221
222
model_state = copy .deepcopy (model .state_dict ())
222
223
op_state = copy .deepcopy (optimizer .state_dict ())
223
224
else :
@@ -232,10 +233,11 @@ def main():
232
233
adjust_rate_flag = True
233
234
adjust_time += 1
234
235
adjust_rate_count = 0
235
-
236
- if adjust_time == 8 :
236
+ acc_best = acc_best_true
237
237
model .load_state_dict (model_state )
238
238
optimizer .load_state_dict (op_state )
239
+
240
+ if adjust_time == 8 :
239
241
stop_train = True
240
242
241
243
time_used = (time .time () - start_time ) / 60
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ def main():
183
183
count = 0
184
184
learning_rate = init_lr
185
185
acc_best = - 100
186
+ acc_best_true = - 100
186
187
adjust_rate_count = 0
187
188
adjust_rate_flag = False
188
189
stop_train = False
@@ -225,8 +226,8 @@ def main():
225
226
op_state = copy .deepcopy (optimizer .state_dict ())
226
227
elif (acc > acc_best - end_adjust_acc ):
227
228
adjust_rate_count += 1
228
- if acc > acc_best and adjust_rate_count == 10 :
229
- acc_best = acc
229
+ if acc > acc_best and acc > acc_best_true :
230
+ acc_best_true = acc
230
231
model_state = copy .deepcopy (model .state_dict ())
231
232
op_state = copy .deepcopy (optimizer .state_dict ())
232
233
else :
@@ -241,10 +242,11 @@ def main():
241
242
adjust_rate_flag = True
242
243
adjust_time += 1
243
244
adjust_rate_count = 0
244
-
245
- if adjust_time == 8 :
245
+ acc_best = acc_best_true
246
246
model .load_state_dict (model_state )
247
247
optimizer .load_state_dict (op_state )
248
+
249
+ if adjust_time == 8 :
248
250
stop_train = True
249
251
250
252
time_used = (time .time () - start_time ) / 60
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ def main():
175
175
count = 0
176
176
learning_rate = init_lr
177
177
acc_best = - 100
178
+ acc_best_true = - 100
178
179
adjust_rate_flag = False
179
180
stop_train = False
180
181
adjust_time = 0
@@ -216,8 +217,8 @@ def main():
216
217
op_state = copy .deepcopy (optimizer .state_dict ())
217
218
elif (acc > acc_best - end_adjust_acc ):
218
219
adjust_rate_count += 1
219
- if acc > acc_best and adjust_rate_count == 10 :
220
- acc_best = acc
220
+ if acc > acc_best and acc > acc_best_true :
221
+ acc_best_true = acc
221
222
model_state = copy .deepcopy (model .state_dict ())
222
223
op_state = copy .deepcopy (optimizer .state_dict ())
223
224
else :
@@ -233,10 +234,11 @@ def main():
233
234
adjust_rate_flag = True
234
235
adjust_time += 1
235
236
adjust_rate_count = 0
236
-
237
- if adjust_time == 8 :
237
+ acc_best = acc_best_true
238
238
model .load_state_dict (model_state )
239
239
optimizer .load_state_dict (op_state )
240
+
241
+ if adjust_time == 8 :
240
242
stop_train = True
241
243
242
244
time_used = (time .time () - start_time ) / 60
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ def main():
183
183
count = 0
184
184
learning_rate = init_lr
185
185
acc_best = - 100
186
+ acc_best_true = - 100
186
187
adjust_rate_flag = False
187
188
stop_train = False
188
189
adjust_time = 0
@@ -224,8 +225,8 @@ def main():
224
225
op_state = copy .deepcopy (optimizer .state_dict ())
225
226
elif (acc > acc_best - end_adjust_acc ):
226
227
adjust_rate_count += 1
227
- if acc > acc_best and adjust_rate_count == 10 :
228
- acc_best = acc
228
+ if acc > acc_best and acc > acc_best_true :
229
+ acc_best_true = acc
229
230
model_state = copy .deepcopy (model .state_dict ())
230
231
op_state = copy .deepcopy (optimizer .state_dict ())
231
232
else :
@@ -241,10 +242,11 @@ def main():
241
242
adjust_rate_flag = True
242
243
adjust_time += 1
243
244
adjust_rate_count = 0
244
-
245
- if adjust_time == 8 :
245
+ acc_best = acc_best_true
246
246
model .load_state_dict (model_state )
247
247
optimizer .load_state_dict (op_state )
248
+
249
+ if adjust_time == 8 :
248
250
stop_train = True
249
251
250
252
time_used = (time .time () - start_time ) / 60
You can’t perform that action at this time.
0 commit comments