class_docstr: 用于读取预训练的 embedding, 读取结果可直接载入为模型参数。
class_docstr_tok: ["\u7528\u4e8e\u8bfb\u53d6\u9884\u8bad\u7ec3\u7684","embedding",",","\u8bfb\u53d6\u7ed3\u679c\u53ef\u76f4\u63a5\u8f7d\u5165\u4e3a\u6a21\u578b\u53c2\u6570\u3002"]
docstr: 从 ``embed_filepath`` 中读取预训练的 word vector。根据预训练的词表读取 embedding 并生成一个对应的 :class:`~fastNLP.core.Vocabulary` 。
  
  :param embed_filepath: 预训练的 embedding 的路径。
  :param dtype: 读出的 embedding 的类型
  :param padding: 词表中的 *padding* 的 token。
  :param unknown: 词表中的 *unknown* 的 token。
  :param normalize: 是否将每个 vector 归一化到 norm 为 1
  :param error: 可以为以下值之一： ``['ignore', 'strict']`` 。如果为  ``ignore`` ，错误将自动跳过；如果是 ``strict`` ，错误将抛出。
      这里主要可能出错的地方在于词表有空行或者词表出现了维度不一致。
  :return: 返回两个结果，第一个返回值为 :class:`numpy.ndarray`，大小为 ``[词表大小+x, 词表维度]`` 。 ``词表大小+x`` 是由于最终的大小还取决于
      是否使用 ``padding``，以及 ``unknown`` 有没有在词表中找到对应的词。 第二个返回值为 :class:`~fastNLP.core.Vocabulary` 类型的词表，其中
      词的顺序与 embedding 的顺序是一一对应的。
docstr_tok: ["\u4ece","``","embed_filepath","``","\u4e2d\u8bfb\u53d6\u9884\u8bad\u7ec3\u7684","word","vector\u3002\u6839\u636e\u9884\u8bad\u7ec3\u7684\u8bcd\u8868\u8bfb\u53d6","embedding","\u5e76\u751f\u6210\u4e00\u4e2a\u5bf9\u5e94\u7684",":","class",":","`","~fastNLP.core.Vocabulary","`","\u3002",":","param","embed_filepath",":","\u9884\u8bad\u7ec3\u7684","embedding","\u7684\u8def\u5f84\u3002",":","param","dtype",":","\u8bfb\u51fa\u7684","embedding","\u7684\u7c7b\u578b",":","param","padding",":","\u8bcd\u8868\u4e2d\u7684","*","padding","*","\u7684","token\u3002",":","param","unknown",":","\u8bcd\u8868\u4e2d\u7684","*","unknown","*","\u7684","token\u3002",":","param","normalize",":","\u662f\u5426\u5c06\u6bcf\u4e2a","vector","\u5f52\u4e00\u5316\u5230","norm","\u4e3a","1",":","param","error",":","\u53ef\u4ee5\u4e3a\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a","``","[","'ignore","'",",","'strict","'","]","``","\u3002\u5982\u679c\u4e3a","``","ignore","``","\uff0c\u9519\u8bef\u5c06\u81ea\u52a8\u8df3\u8fc7\uff1b\u5982\u679c\u662f","``","strict","``","\uff0c\u9519\u8bef\u5c06\u629b\u51fa\u3002","\u8fd9\u91cc\u4e3b\u8981\u53ef\u80fd\u51fa\u9519\u7684\u5730\u65b9\u5728\u4e8e\u8bcd\u8868\u6709\u7a7a\u884c\u6216\u8005\u8bcd\u8868\u51fa\u73b0\u4e86\u7ef4\u5ea6\u4e0d\u4e00\u81f4\u3002",":","return",":","\u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\uff0c\u7b2c\u4e00\u4e2a\u8fd4\u56de\u503c\u4e3a",":","class",":","`","numpy.ndarray","`","\uff0c\u5927\u5c0f\u4e3a","``","[","\u8bcd\u8868\u5927\u5c0f+x",",","\u8bcd\u8868\u7ef4\u5ea6","]","``","\u3002","``","\u8bcd\u8868\u5927\u5c0f+x","``","\u662f\u7531\u4e8e\u6700\u7ec8\u7684\u5927\u5c0f\u8fd8\u53d6\u51b3\u4e8e","\u662f\u5426\u4f7f\u7528","``","padding","``","\uff0c\u4ee5\u53ca","``","unknown","``","\u6709\u6ca1\u6709\u5728\u8bcd\u8868\u4e2d\u627e\u5230\u5bf9\u5e94\u7684\u8bcd\u3002","\u7b2c\u4e8c\u4e2a\u8fd4\u56de\u503c\u4e3a",":","class",":","`","~fastNLP.core.Vocabulary","`","\u7c7b\u578b\u7684\u8bcd\u8868\uff0c\u5176\u4e2d","\u8bcd\u7684\u987a\u5e8f\u4e0e","embedding","\u7684\u987a\u5e8f\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\u3002"]
code: def load_without_vocab(
      embed_filepath: str,
      dtype=np.float32,
      padding: str = "<pad>",
      unknown: str = "<unk>",
      normalize: bool = True,
      error: str = "ignore",
  ):
      r"""
      从 ``embed_filepath`` 中读取预训练的 word vector。根据预训练的词表读取 embedding 并生成一个对应的 :class:`~fastNLP.core.Vocabulary` 。
  
      :param embed_filepath: 预训练的 embedding 的路径。
      :param dtype: 读出的 embedding 的类型
      :param padding: 词表中的 *padding* 的 token。
      :param unknown: 词表中的 *unknown* 的 token。
      :param normalize: 是否将每个 vector 归一化到 norm 为 1
      :param error: 可以为以下值之一： ``['ignore', 'strict']`` 。如果为  ``ignore`` ，错误将自动跳过；如果是 ``strict`` ，错误将抛出。
          这里主要可能出错的地方在于词表有空行或者词表出现了维度不一致。
      :return: 返回两个结果，第一个返回值为 :class:`numpy.ndarray`，大小为 ``[词表大小+x, 词表维度]`` 。 ``词表大小+x`` 是由于最终的大小还取决于
          是否使用 ``padding``，以及 ``unknown`` 有没有在词表中找到对应的词。 第二个返回值为 :class:`~fastNLP.core.Vocabulary` 类型的词表，其中
          词的顺序与 embedding 的顺序是一一对应的。
  
      """
      vocab = Vocabulary(padding=padding, unknown=unknown)
      vec_dict = {}
      found_unknown = False
      found_pad = False
  
      with open(embed_filepath, "r", encoding="utf-8") as f:
          line = f.readline()
          start = 1
          dim = -1
          if len(line.strip().split()) != 2:
              f.seek(0)
              start = 0
          for idx, line in enumerate(f, start=start):
              try:
                  parts = line.strip().split()
                  if dim == -1:
                      dim = len(parts) - 1
                  word = "".join(parts[:-dim])
                  nums = parts[-dim:]
                  vec = np.fromstring(
                      " ".join(nums), sep=" ", dtype=dtype, count=dim
                  )
                  vec_dict[word] = vec
                  vocab.add_word(word)
                  if unknown is not None and unknown == word:
                      found_unknown = True
                  if padding is not None and padding == word:
                      found_pad = True
              except Exception as e:
                  if error == "ignore":
                      logger.warning(
                          "Error occurred at the {} line.".format(idx)
                      )
                      pass
                  else:
                      logging.error(
                          "Error occurred at the {} line.".format(idx)
                      )
                      raise e
          if dim == -1:
              raise RuntimeError(
                  "{} is an empty file.".format(embed_filepath)
              )
          matrix = np.random.randn(len(vocab), dim).astype(dtype)
          for key, vec in vec_dict.items():
              index = vocab.to_index(key)
              matrix[index] = vec
  
          if ((unknown is not None) and (not found_unknown)) or (
              (padding is not None) and (not found_pad)
          ):
              start_idx = 0
              if padding is not None:
                  start_idx += 1
              if unknown is not None:
                  start_idx += 1
  
              mean = np.mean(matrix[start_idx:], axis=0, keepdims=True)
              std = np.std(matrix[start_idx:], axis=0, keepdims=True)
              if (unknown is not None) and (not found_unknown):
                  matrix[start_idx - 1] = (
                      np.random.randn(1, dim).astype(dtype) * std + mean
                  )
              if (padding is not None) and (not found_pad):
                  matrix[0] = (
                      np.random.randn(1, dim).astype(dtype) * std + mean
                  )
  
          if normalize:
              matrix /= np.linalg.norm(matrix, axis=1, keepdims=True)
  
          return matrix, vocab
  
file_path: fastNLP/fastNLP/io/embed_loader.py
imports: import logging
  import os
  from typing import Callable
  import numpy
  from fastNLP.core.utils.utils import Option
  from fastNLP.core.vocabulary import Vocabulary
  from fastNLP.core.log import logger
label_desc: Use image node_id 3 for calling the EmbedLoader obj's underlying member method code with example usage: obj.load_without_vocab(embed_filepath, dtype, padding, unknown, normalize, error) and returns: matrix,  vocab