def _load_embedding_serialized(self, pretrained_file_path):
        """Load embedding vectors from a pre-trained token embedding file.

        For every unknown token, if its representation `self.unknown_token` is encountered in the
        pre-trained token embedding file, index 0 of `self.idx_to_vec` maps to the pre-trained token
        embedding vector loaded from the file; otherwise, index 0 of `self.idx_to_vec` maps to the
        text embedding vector initialized by `self._init_unknown_vec`.

        ValueError is raised if a token occurs multiple times.
        """

        deserialized_embedding = TokenEmbedding.deserialize(pretrained_file_path)
        if deserialized_embedding.unknown_token:
            # Some .npz files on S3 may contain an unknown token and its
            # respective embedding. As a workaround, we assume that C.UNK_IDX
            # is the same now as it was when the .npz was generated. Under this
            # assumption we can safely overwrite the respective token and
            # vector from the npz.
            if deserialized_embedding.unknown_token:
                idx_to_token = deserialized_embedding.idx_to_token
                idx_to_vec = deserialized_embedding.idx_to_vec
                idx_to_token[C.UNK_IDX] = self.unknown_token
                if self._init_unknown_vec:
                    vec_len = idx_to_vec.shape[1]
                    idx_to_vec[C.UNK_IDX] = self._init_unknown_vec(shape=vec_len)
            else:
                # If the TokenEmbedding shall not have an unknown token, we
                # just delete the one in the npz.
                assert C.UNK_IDX == 0
                idx_to_token = deserialized_embedding.idx_to_token[C.UNK_IDX + 1:]
                idx_to_vec = deserialized_embedding.idx_to_vec[C.UNK_IDX + 1:]
        else:
            idx_to_token = deserialized_embedding.idx_to_token
            idx_to_vec = deserialized_embedding.idx_to_vec

        if not len(set(idx_to_token)) == len(idx_to_token):
            raise ValueError('Serialized embedding invalid. '
                             'It contains duplicate tokens.')

        if self.unknown_token:
            try:
                unknown_token_idx = deserialized_embedding.idx_to_token.index(
                    self.unknown_token)
                idx_to_token[C.UNK_IDX], idx_to_token[
                    unknown_token_idx] = idx_to_token[
                        unknown_token_idx], idx_to_token[C.UNK_IDX]
                idxs = [C.UNK_IDX, unknown_token_idx]
                idx_to_vec[idxs] = idx_to_vec[idxs[::-1]]
            except ValueError:
                vec_len = idx_to_vec.shape[1]
                idx_to_token.insert(0, self.unknown_token)
                idx_to_vec = nd.concat(
                    self._init_unknown_vec(shape=vec_len).reshape((1, -1)),
                    idx_to_vec, dim=0)

        self._idx_to_token = idx_to_token
        self._idx_to_vec = idx_to_vec
        self._token_to_idx.update((token, idx) for idx, token in enumerate(self._idx_to_token))
Load embedding vectors from a pre-trained token embedding file.

        For every unknown token, if its representation `self.unknown_token` is encountered in the
        pre-trained token embedding file, index 0 of `self.idx_to_vec` maps to the pre-trained token
        embedding vector loaded from the file; otherwise, index 0 of `self.idx_to_vec` maps to the
        text embedding vector initialized by `self._init_unknown_vec`.

        ValueError is raised if a token occurs multiple times.