class_docstr: Generate Dense Embeddings.
class_docstr_tok: ["Generate","Dense","Embeddings","."]
docstr: Load passages from tsv file.
  
  Limit passages returned according to shard number.
  
  :return passages:
      return a list of (doc_id, doc_text, doc_title) tuples
docstr_tok: ["Load","passages","from","tsv","file",".","Limit","passages","returned","according","to","shard","number",".",":","return","passages",":","return","a","list","of","(","doc_id",",","doc_text",",","doc_title",")","tuples"]
code: def load_passages(self) -> List[Tuple[str, str, str]]:
      """
      Load passages from tsv file.
  
      Limit passages returned according to shard number.
  
      :return passages:
          return a list of (doc_id, doc_text, doc_title) tuples
      """
      logging.info(f"Loading {self.opt['passages_file']}")
      rows = load_passages_list(
          modelzoo_path(
              self.opt["datapath"], self.opt["passages_file"]
          )  # type: ignore
      )
      shard_id, num_shards = (
          self.opt["shard_id"],
          self.opt["num_shards"],
      )
      shard_size = int(len(rows) / num_shards)
      if shard_id < len(rows) % num_shards:
          # don't forget the remainder!
          shard_size += 1
      start_idx = shard_id * shard_size
      end_idx = start_idx + shard_size
      logging.info(
          f"Shard {shard_id} of {num_shards} encoding psg index "
          f"{start_idx} to {end_idx}, out of {len(rows)}"
      )
      return rows[start_idx:end_idx]
  
imports: import os
  import torch
  import torch.cuda
  from typing import List, Tuple
  from parlai.agents.transformer.transformer import TransformerRankerAgent
  from parlai.agents.transformer.polyencoder import PolyencoderAgent
  from parlai.core.agents import create_agent_from_model_file, create_agent
  from parlai.core.build_data import modelzoo_path
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.script import ParlaiScript
  from parlai.core.torch_ranker_agent import TorchRankerAgent
  import parlai.utils.logging
  from parlai.agents.transformer.dropout_poly import DropoutPolyAgent
  from parlai.agents.rag.retrievers import load_passages_list
  import parlai.agents.rag.dpr
label_desc: Use image node_id 4 for calling the Generator obj's underlying member method code with example usage: obj.load_passages() and returns: rows