composer.models.bert.bert_hparams#

YAHP general and classification interfaces for BERTModel.

Hparams

These classes are used with yahp for YAML-based configuration.

BERTForClassificationHparams

YAHP classification interface for BERTModel.

BERTHparams

YAHP interface for BERTModel.

class composer.models.bert.bert_hparams.BERTForClassificationHparams(initializers=<factory>, num_classes=None, tokenizer_name=None, pretrained_model_name=None, model_config=<factory>, use_pretrained=False, gradient_checkpointing=False, num_labels=2)[source]#

Bases: composer.models.transformer_hparams.TransformerHparams

YAHP classification interface for BERTModel.

Parameters
  • pretrained_model_name (str) โ€“ Pretrained model name to pull from Hugging Face Model Hub.

  • model_config (Dict[str, JSON]) โ€“ A dictionary providing a HuggingFace model configuration.

  • tokenizer_name (Optional[str]) โ€“ The tokenizer used for this model, necessary to assert required model inputs.

  • use_pretrained (bool, optional) โ€“ Whether to initialize the model with the pretrained weights.

  • gradient_checkpointing (bool, optional) โ€“ Use gradient checkpointing. Default: False.

  • num_labels (int, optional) โ€“ The number of classes in the segmentation task. Default: 2.

class composer.models.bert.bert_hparams.BERTHparams(initializers=<factory>, num_classes=None, tokenizer_name=None, pretrained_model_name=None, model_config=<factory>, use_pretrained=False, gradient_checkpointing=False)[source]#

Bases: composer.models.transformer_hparams.TransformerHparams

YAHP interface for BERTModel.

Parameters
  • pretrained_model_name (str) โ€“ โ€œPretrained model name to pull from Huggingface Model Hub.โ€

  • model_config (Dict[str, JSON]) โ€“ A dictionary providing a HuggingFace model configuration.

  • tokenizer_name (str) โ€“ The tokenizer used for this model, necessary to assert required model inputs.

  • use_pretrained (bool, optional) โ€“ Whether to initialize the model with the pretrained weights.

  • gradient_checkpointing (bool, optional) โ€“ Use gradient checkpointing. default: False.