Skip to content

Commit 9ae6d6c

Browse files
authored
Merge pull request #343 from Vibsteamer/patch-1
user-defined training_reuse_old_ratio is mandatory
2 parents d15f199 + f80883b commit 9ae6d6c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dpgen/generator/run.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,21 @@ def make_train (iter_index,
197197
training_iter0_model = jdata.get('training_iter0_model_path', [])
198198
training_init_model = jdata.get('training_init_model', False)
199199
training_reuse_iter = jdata.get('training_reuse_iter')
200-
training_reuse_old_ratio = jdata.get('training_reuse_old_ratio', 0.2)
200+
training_reuse_old_ratio = jdata.get('training_reuse_old_ratio', None)
201201
training_reuse_stop_batch = jdata.get('training_reuse_stop_batch', 400000)
202202
training_reuse_start_lr = jdata.get('training_reuse_start_lr', 1e-4)
203203
training_reuse_start_pref_e = jdata.get('training_reuse_start_pref_e', 0.1)
204204
training_reuse_start_pref_f = jdata.get('training_reuse_start_pref_f', 100)
205205
model_devi_activation_func = jdata.get('model_devi_activation_func', None)
206206

207+
if training_reuse_iter is not None and training_reuse_old_ratio is None:
208+
raise RuntimeError("training_reuse_old_ratio not found but is mandatory when using init-model (training_reuse_iter is detected in param).\n" \
209+
"It defines the ratio of the old-data picking probability to the all-data(old-data plus new-data) picking probability in training after training_reuse_iter.\n" \
210+
"Denoting the index of the current iter as N (N >= training_reuse_iter ), old-data refers to those existed before the N-1 iter, and new-data refers to that obtained by the N-1 iter.\n" \
211+
"A recommended strategy is making the old-to-new ratio close to 10 times of the default value, to reasonably increase the sensitivity of the model to the new-data.\n" \
212+
"By default, the picking probability of data from one system or one iter is proportional to the number of batches (the number of frames divided by batch_size) of that systems or iter.\n" \
213+
"Detailed discussion about init-model (in Chinese) please see https://mp.weixin.qq.com/s/qsKMZ0j270YhQKvwXUiFvQ")
214+
207215
if iter_index > 0 and _check_empty_iter(iter_index-1, fp_task_min) :
208216
log_task('prev data is empty, copy prev model')
209217
copy_model(numb_models, iter_index-1, iter_index)

0 commit comments

Comments
 (0)