@@ -136,12 +136,6 @@ def check_arg_compatibility(args: argparse.Namespace):
136136 # Length 1: expand the list to the appropriate length
137137 args .target_factors_share_embedding = args .target_factors_share_embedding * n_target_factors
138138
139- # Check arguments used for blocking cross-attention between decoder and encoded prepended tokens
140- if args .transformer_block_prepended_cross_attention :
141- check_condition (args .end_of_prepending_tag is not None ,
142- 'In order to block cross-attention between decoder and encoded prepended tokens, '
143- 'please specify the tag indicating the end of prepended text using --end-of-prepending-tag' )
144-
145139 check_condition (not (args .amp and args .apex_amp ), 'Use either --amp (safer) or --apex-amp (faster).' )
146140
147141 if args .dtype != C .DTYPE_FP32 :
@@ -305,8 +299,6 @@ def create_data_iters_and_vocabs(args: argparse.Namespace,
305299 C .TRAINING_ARG_PREPARED_DATA )
306300 if args .prepared_data is not None :
307301 utils .check_condition (args .source is None and args .target is None , either_raw_or_prepared_error_msg )
308- if args .end_of_prepending_tag is not None :
309- logger .warning ("The end-of-prepending tag specified in the prepared data will be used." )
310302 if not resume_training :
311303 utils .check_condition (args .source_vocab is None and args .target_vocab is None ,
312304 "You are using a prepared data folder, which is tied to a vocabulary. "
@@ -320,6 +312,15 @@ def create_data_iters_and_vocabs(args: argparse.Namespace,
320312 batch_type = args .batch_type ,
321313 batch_sentences_multiple_of = args .batch_sentences_multiple_of )
322314
315+ # Check arguments used for blocking cross-attention between decoder and encoded prepended tokens
316+ if args .transformer_block_prepended_cross_attention :
317+ check_condition (data_config .eop_id != C .INVALID_ID ,
318+ 'In order to block cross-attention between decoder and encoded prepended tokens, '
319+ 'please specify the tag indicating the end of prepended text when preparing the data using '
320+ '--end-of-prepending-tag' )
321+ if args .end_of_prepending_tag is not None :
322+ logger .warning ("The end-of-prepending tag specified in the prepared data will be used." )
323+
323324 check_condition (all ([combine in [C .FACTORS_COMBINE_SUM , C .FACTORS_COMBINE_AVERAGE ]
324325 for combine in args .source_factors_combine ])
325326 or len (source_vocabs ) == len (args .source_factors_num_embed ) + 1 ,
@@ -356,6 +357,11 @@ def create_data_iters_and_vocabs(args: argparse.Namespace,
356357 else :
357358 utils .check_condition (args .prepared_data is None and args .source is not None and args .target is not None ,
358359 either_raw_or_prepared_error_msg )
360+ # Check arguments used for blocking cross-attention between decoder and encoded prepended tokens
361+ if args .transformer_block_prepended_cross_attention :
362+ check_condition (args .end_of_prepending_tag is not None ,
363+ 'In order to block cross-attention between decoder and encoded prepended tokens, '
364+ 'please specify the tag indicating the end of prepended text using --end-of-prepending-tag' )
359365
360366 if resume_training :
361367 # Load the existing vocabs created when starting the training run.
0 commit comments