class_docstr: Negative sampling based skip-gram
class_docstr_tok: ["Negative","sampling","based","skip-gram"]
docstr: For ogb leaderboard.
docstr_tok: ["For","ogb","leaderboard","."]
code: def save_embedding_pt(self, dataset, file_name):
      """For ogb leaderboard."""
      try:
          max_node_id = max(dataset.node2id.keys())
          if max_node_id + 1 != self.emb_size:
              print("WARNING: The node ids are not serial.")
  
          embedding = torch.zeros(max_node_id + 1, self.emb_dimension)
          index = torch.LongTensor(
              list(
                  map(
                      lambda id: dataset.id2node[id],
                      list(range(self.emb_size)),
                  )
              )
          )
          embedding.index_add_(
              0, index, self.u_embeddings.weight.cpu().data
          )
  
          if self.norm:
              embedding /= torch.sqrt(
                  torch.sum(embedding.mul(embedding), 1) + 1e-6
              ).unsqueeze(1)
          torch.save(embedding, file_name)
      except:
          self.save_embedding_pt_dgl_graph(dataset, file_name)
  
imports: import random
  import numpy
  import torch
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  from torch.multiprocessing import Queue
  from torch.nn import init
label_desc: Use image node_id 12 for calling the SkipGramModel obj's underlying member method code with example usage: obj.save_embedding_pt(dataset, file_name) without return types