bert_hparams#
YAHP general and classification interfaces for
BERTModel
.
Hparams
These classes are used with yahp
for YAML
-based configuration.
- class composer.models.bert.bert_hparams.BERTForClassificationHparams(initializers=<factory>, num_classes=None, num_labels=2, pretrained_model_name=None, model_config=<factory>, use_pretrained=False, tokenizer_name=None, gradient_checkpointing=False)[source]#
Bases:
composer.models.model_hparams.ModelHparams
YAHP interface for
BERTModel
.- Parameters
num_labels (int, optional) โ The number of classes in the classification task. Default:
2
.pretrained_model_name (str, optional) โ Pretrained model name to pull from Hugging Face Model Hub.
model_config (Dict[str, JSON]) โ A dictionary providing a HuggingFace model configuration.
use_pretrained (bool, optional) โ Whether to initialize the model with the pretrained weights.
tokenizer_name (Optional[str]) โ The tokenizer used for this model, necessary to assert required model inputs. Default
None
.gradient_checkpointing (bool, optional) โ Use gradient checkpointing. default: False.
- class composer.models.bert.bert_hparams.BERTHparams(initializers=<factory>, num_classes=None, model_config=<factory>, pretrained_model_name=None, use_pretrained=False, tokenizer_name=None, gradient_checkpointing=False)[source]#
Bases:
composer.models.model_hparams.ModelHparams
YAHP interface for
BERTModel
.- Parameters
model_config (Dict[str, JSON], optional) โ A dictionary providing a HuggingFace model configuration.
pretrained_model_name (str, optional) โ Pretrained model name to pull from Hugging Face Model Hub.
use_pretrained (bool, optional) โ Whether to initialize the model with the pretrained weights.
tokenizer_name (str, optional) โ The tokenizer used for this model, necessary to assert required model inputs. Default
None
.gradient_checkpointing (bool, optional) โ Use gradient checkpointing. default: False.