class_docstr: Type for converting string to tensor and back.
  
  Parameters
  ----------
  tokenizer: Union[str, Any]
      Tokenizer to convert input text to indices. If the tokenizer is string,
      it will be loaded using Huggingface transformers' AutoTokenizer and hence
      must be available here https://huggingface.co/models. If it's an object,
      it needs to have `encode` and `decode` method for deserialization and
      serialization respectively.
  
  TODO: Allow other arguments such as language, max_len etc. Add guidelines
   to write custom tokenizer
code: def deserialize(self, text: str) -> Tensor:
      return self.tokenizer.encode(text, return_tensors="pt")
  
file_path: lightning-flash/src/flash/core/serve/types/text.py
imports: import warnings
  from dataclasses import dataclass
  from typing import Any, Union
  from torch import Tensor
  from flash.core.serve.types.base import BaseType
label_desc: Use image node_id 2 for calling the Text obj's underlying member method code with example usage: obj.deserialize(text) and returns: self