Model
December 28, 2022 ยท View on GitHub
Model List
To support the rapid progress of PLMs on text generation, TextBox 2.0 incorporates 47 models/modules. The following table lists the name and reference of each model/module. Click the model/module name for detailed usage instructions.
Pre-trained Model Parameters
TextBox 2.0 is compatible with Hugging Face, so model_path receives a name of model on Hugging Face like facebook/bart-base or just a local path. config_path and tokenizer_path (same value as model_path by default) also receive a Hugging Face model or a local path.
Besides, config_kwargs and tokenizer_kwargs are useful when additional parameters are required.
For example, when building a Task-oriented Dialogue System, special tokens can be added with additional_special_tokens; fast tokenization can also be switched with use_fast:
config_kwargs: {}
tokenizer_kwargs: {'use_fast': False, 'additional_special_tokens': ['[db_0]', '[db_1]', '[db_2]'] }
Other commonly used parameters include label_smoothing: <smooth-loss-weight>
The full keyword arguments should be found in PreTrainedTokenizer or documents of the corresponding tokenizer.
Generation Parameters
The pre-trained model can perform generation using various methods by combining different parameters. By default, beam search is adapted:
generation_kwargs: {'num_beams': 5, 'early_stopping': True}
Nucleus sampling is also supported by pre-trained model:
generation_kwargs: {'do_sample': True, 'top_k': 10, 'top_p': 0.9}