docstr: Test if embed-mode is triggered when flagged.
  Checks if returned embeddings are of size N_rows x N_embed_dim
docstr_tok: ["Test","if","embed-mode","is","triggered","when","flagged",".","Checks","if","returned","embeddings","are","of","size","N_rows","x","N_embed_dim"]
code: def test_embed_mode(self):
      """
      Test if embed-mode is triggered when flagged.
      Checks if returned embeddings are of size N_rows x N_embed_dim
      """  # noqa
      seed = 2
  
      np.random.seed(seed)
      torch.manual_seed(seed)
      random.seed(seed)
  
      # Make priming data:
      train, test = create_synthetic_data(1000)
      output_enc = BinaryEncoder(is_target=True)
      output_enc.prepare(train["label"])
      encoded_target_values = output_enc.encode(train["label"])
  
      # Prepare the language encoder
      enc = PretrainedLangEncoder(
          stop_after=10, embed_mode=True, output_type=dtype.binary
      )
      enc.prepare(
          train["text"],
          pd.DataFrame(),
          encoded_target_values=encoded_target_values,
      )
  
      # Embeddings of size N_vocab x N_embed_dim for most models (assumes distilbert)
      N_embed_dim = (
          enc._model.base_model.embeddings.word_embeddings.weight.shape[
              -1
          ]
      )
      embeddings = enc.encode(test["text"])
      assert embeddings.shape[0] == test.shape[0]
      assert embeddings.shape[1] == N_embed_dim
  
imports: import unittest
  import numpy
  import random
  import torch
  from torch.nn.functional import softmax
  from sklearn.metrics import accuracy_score
  from lightwood.encoder import BinaryEncoder, NumericEncoder
  from lightwood.encoder.text import PretrainedLangEncoder
  from type_infer.dtype import dtype
  import pandas
  import os
  import pathlib
label_desc: Use image node_id 2 for calling the TestPretrainedLangEncoder obj's underlying member method code with example usage: obj.test_embed_mode() without return types