class_docstr: Sentence embeddings using MPNet.
  
  MPNet adopts a novel pre-training method, named masked and permuted language modeling,
  to inherit the advantages of masked language modeling and permuted language modeling for
  natural language understanding.
  
  Pretrained models can be loaded with :meth:`.pretrained` of the companion
  object:
  
  >>> embeddings = MPNetEmbeddings.pretrained() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("mpnet_embeddings")
  
  
  The default model is ``"all_mpnet_base_v2"``, if no name is provided.
  
  For available pretrained models please see the
  `Models Hub <https://sparknlp.org/models?q=MPNet>`__.
  
  
  ====================== ======================
  Input Annotation types Output Annotation type
  ====================== ======================
  ``DOCUMENT``            ``SENTENCE_EMBEDDINGS``
  ====================== ======================
  
  Parameters
  ----------
  batchSize
      Size of every batch , by default 8
  dimension
      Number of embedding dimensions, by default 768
  caseSensitive
      Whether to ignore case in tokens for embeddings matching, by default False
  maxSentenceLength
      Max sentence length to process, by default 512
  configProtoBytes
      ConfigProto from tensorflow, serialized into byte array.
  
  References
  ----------
  `MPNet: Masked and Permuted Pre-training for Language Understanding <https://arxiv.org/pdf/2004.09297>`__
  
  https://github.com/microsoft/MPNet
  
  **Paper abstract**
  
  *BERT adopts masked language modeling (MLM) for pre-training and is one of the most successful pre-training models.
   Since BERT neglects dependency among predicted tokens, XLNet introduces permuted language modeling (PLM) for
   pre-training to address this problem. However, XLNet does not leverage the full position information of a sentence
   and thus suffers from position discrepancy between pre-training and fine-tuning. In this paper, we propose MPNet,
   a novel pre-training method that inherits the advantages of BERT and XLNet and avoids their limitations. MPNet
   leverages the dependency among predicted tokens through permuted language modeling (vs. MLM in BERT), and takes
   auxiliary position information as input to make the model see a full sentence and thus reducing the position
   discrepancy (vs. PLM in XLNet). We pre-train MPNet on a large-scale dataset (over 160GB text corpora) and fine-tune
   on a variety of down-streaming tasks (GLUE, SQuAD, etc). Experimental results show that MPNet outperforms MLM and
   PLM by a large margin, and achieves better results on these tasks compared with previous state-of-the-art
   pre-trained methods (e.g., BERT, XLNet, RoBERTa) under the same model setting.*
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from pyspark.ml import Pipeline
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> embeddings = MPNetEmbeddings.pretrained() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("mpnet_embeddings")
  >>> embeddingsFinisher = EmbeddingsFinisher() \
  ...     .setInputCols(["mpnet_embeddings"]) \
  ...     .setOutputCols("finished_embeddings") \
  ...     .setOutputAsVector(True)
  >>> pipeline = Pipeline().setStages([
  ...     documentAssembler,
  ...     embeddings,
  ...     embeddingsFinisher
  ... ])
  >>> data = spark.createDataFrame([["This is an example sentence", "Each sentence is converted"]]).toDF("text")
  >>> result = pipeline.fit(data).transform(data)
  >>> result.selectExpr("explode(finished_embeddings) as result").show(5, 80)
  +--------------------------------------------------------------------------------+
  |                                                                          result|
  +--------------------------------------------------------------------------------+
  |[[0.022502584, -0.078291744, -0.023030775, -0.0051000593, -0.080340415, 0.039...|
  |[[0.041702367, 0.0010974605, -0.015534201, 0.07092203, -0.0017729357, 0.04661...|
  +--------------------------------------------------------------------------------+
docstr: Downloads and loads a pretrained model.
  
  Parameters
  ----------
  name : str, optional
      Name of the pretrained model, by default "all_mpnet_base_v2"
  lang : str, optional
      Language of the pretrained model, by default "en"
  remote_loc : str, optional
      Optional remote address of the resource, by default None. Will use
      Spark NLPs repositories otherwise.
  
  Returns
  -------
  MPNetEmbeddings
      The restored model
code: def pretrained(name="all_mpnet_base_v2", lang="en", remote_loc=None):
      """Downloads and loads a pretrained model.
  
      Parameters
      ----------
      name : str, optional
          Name of the pretrained model, by default "all_mpnet_base_v2"
      lang : str, optional
          Language of the pretrained model, by default "en"
      remote_loc : str, optional
          Optional remote address of the resource, by default None. Will use
          Spark NLPs repositories otherwise.
  
      Returns
      -------
      MPNetEmbeddings
          The restored model
      """
      from sparknlp.pretrained import ResourceDownloader
  
      return ResourceDownloader.downloadModel(
          MPNetEmbeddings, name, lang, remote_loc
      )
  
file_path: spark-nlp/python/sparknlp/annotator/embeddings/mpnet_embeddings.py
imports: from sparknlp.common import *
label_desc: Use image node_id 4 for calling the MPNetEmbeddings obj's underlying member method code with example usage: obj.pretrained(name, lang, remote_loc) and returns: ResourceDownloader