[EncoderDecoderModel] add a add_cross_attention boolean to config (#6377)
* correct encoder decoder model * Apply suggestions from code review * apply sylvains suggestions
This commit is contained in:
committed by
GitHub
parent
06bc347c97
commit
3425936643
@@ -58,6 +58,7 @@ class EncoderDecoderConfig(PretrainedConfig):
|
||||
>>> config_decoder = model.config.decoder
|
||||
>>> # set decoder config to causal lm
|
||||
>>> config_decoder.is_decoder = True
|
||||
>>> config_decoder.add_cross_attention = True
|
||||
|
||||
>>> # Saving the model, including its configuration
|
||||
>>> model.save_pretrained('my-model')
|
||||
@@ -94,8 +95,9 @@ class EncoderDecoderConfig(PretrainedConfig):
|
||||
Returns:
|
||||
:class:`EncoderDecoderConfig`: An instance of a configuration object
|
||||
"""
|
||||
logger.info("Set `config.is_decoder=True` for decoder_config")
|
||||
logger.info("Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config")
|
||||
decoder_config.is_decoder = True
|
||||
decoder_config.add_cross_attention = True
|
||||
|
||||
return cls(encoder=encoder_config.to_dict(), decoder=decoder_config.to_dict())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user