code: def encode_prompts(
      self, prompts: List[str]
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      tokens = []
      lens = []
      for prompt in prompts:
          sub_tokens, sub_len = self.tokenizer.padded_tokens_and_len(
              self.tokenizer.encode(prompt),
              self.text_encoder.max_text_len,
          )
          tokens.append(sub_tokens)
          lens.append(sub_len)
      return (
          torch.tensor(tokens).to(dtype=torch.long, device=self.device),
          torch.tensor(lens).to(dtype=torch.long, device=self.device),
      )
  
file_path: glide-text2im/glide_text2im/clip/model_creation.py
imports: import os
  from functools import lru_cache
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import attr
  import numpy
  import torch
  import torch.nn
  import yaml
  from glide_text2im.tokenizer.simple_tokenizer import SimpleTokenizer
  from .encoders import ImageEncoder, TextEncoder
label_desc: Use image node_id 1 for calling the CLIPModel obj's underlying member method code with example usage: obj.encode_prompts(prompts) and returns: torch,  torch