Refactor Code samples; Test code samples (#5036)
* Refactor code samples * Test docstrings * Style * Tokenization examples * Run rust of tests * First step to testing source docs * Style and BART comment * Test the remainder of the code samples * Style * let to const * Formatting fixes * Ready for merge * Fix fixture + Style * Fix last tests * Update docs/source/quicktour.rst Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> * Addressing @sgugger's comments + Fix MobileBERT in TF Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
This commit is contained in:
@@ -42,20 +42,20 @@ class EncoderDecoderConfig(PretrainedConfig):
|
||||
|
||||
Example::
|
||||
|
||||
from transformers import BertConfig, EncoderDecoderConfig, EncoderDecoderModel
|
||||
>>> from transformers import BertConfig, EncoderDecoderConfig, EncoderDecoderModel
|
||||
|
||||
# Initializing a BERT bert-base-uncased style configuration
|
||||
config_encoder = BertConfig()
|
||||
config_decoder = BertConfig()
|
||||
>>> # Initializing a BERT bert-base-uncased style configuration
|
||||
>>> config_encoder = BertConfig()
|
||||
>>> config_decoder = BertConfig()
|
||||
|
||||
config = EncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
|
||||
>>> config = EncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
|
||||
|
||||
# Initializing a Bert2Bert model from the bert-base-uncased style configurations
|
||||
model = EncoderDecoderModel(config=config)
|
||||
>>> # Initializing a Bert2Bert model from the bert-base-uncased style configurations
|
||||
>>> model = EncoderDecoderModel(config=config)
|
||||
|
||||
# Accessing the model configuration
|
||||
config_encoder = model.config.encoder
|
||||
config_decoder = model.config.decoder
|
||||
>>> # Accessing the model configuration
|
||||
>>> config_encoder = model.config.encoder
|
||||
>>> config_decoder = model.config.decoder
|
||||
"""
|
||||
model_type = "encoder_decoder"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user