code: def from_msg_dict(msg: Dict[str, Any]) -> Self:
      input_tokens = msg["input_tokens"]
      if input_tokens is not None:
          input_tokens = torch.tensor(
              msg["input_tokens"],
              dtype=torch.int32,
              device=torch.device("cpu"),
          )
      return RequestMsg(uid=msg["uid"], input_tokens=input_tokens)
  
imports: from dataclasses import dataclass, field, asdict
  from typing import Any, Dict, List, Iterator, Union
  from typing_extensions import Self
  import torch
  from mii.constants import GenerationFinishReason
  from mii.config import GenerateParamsConfig
label_desc: Use image node_id 2 for calling the RequestMsg obj's underlying member method code with example usage: obj.from_msg_dict(msg) and returns: RequestMsg