class_docstr: Pretraining machinery using SCRIPT from Nijkamp et al., 2021. Always running sparse prediction.
class_docstr_tok: ["Pretraining","machinery","using","SCRIPT","from","Nijkamp","et","al.",",","2021",".","Always","running","sparse","prediction","."]
code: def __init__(self, config):
      super().__init__(config)
      self.cfg = OmegaConf.create(config.arch)
      self.num_labels = getattr(
          config, "num_labels", self.cfg.num_labels
      )
  
      self.encoder = ScriptableLM(config)
      self.prediction_head = PredictionHeadComponent(self.cfg)
  
      self.decoder = torch.nn.Linear(
          self.cfg.embedding.embedding_dim,
          self.cfg.embedding.vocab_size,
          bias=self.cfg.decoder_bias,
      )
      self.decoder.weight = self.encoder.embedding.word_embedding.weight
  
      self.loss_fn = torch.nn.CrossEntropyLoss()
      self.sparse_prediction = self.cfg.sparse_prediction
      assert self.sparse_prediction
  
      self._init_weights()
  
imports: import torch
  from transformers import PretrainedConfig, PreTrainedModel
  from transformers import AutoConfig, AutoModel, AutoModelForMaskedLM, AutoModelForSequenceClassification, AutoModelForTokenClassification
  from typing import Optional
  from omegaconf import OmegaConf
  from .fff import FFF
  from .components import _get_norm_fn, _get_nonlin_fn, EmbeddingComponent, PoolingComponent, PredictionHeadComponent, GLU, get_extended_attention_mask, _init_module
  from .attention import get_attention_mechanism
label_desc: Use image node_id 1 to create a new ScriptableLMForSCRIPTTraining object from inherited base classes: PreTrainedModel with example: obj = ScriptableLMForSCRIPTTraining(config)