class_docstr: Context manager for lazy initialization. Enables initializing the model without allocating real memory.
  
  Args:
      tensor_cls (Union[_MyTensor, LazyTensor], optional): This is only for test. Defaults to LazyTensor.
      default_device (Optional[Union[torch.device, str, int]], optional): Defalt device for initialization.
          If it's cuda, initilization will be accelerated, but cuda memory will be allocated. By default, it's cpu.
          Defaults to None.
class_docstr_tok: ["Context","manager","for","lazy","initialization",".","Enables","initializing","the","model","without","allocating","real","memory",".","Args",":","tensor_cls","(","Union","[","_MyTensor",",","LazyTensor","]",",","optional",")",":","This","is","only","for","test",".","Defaults","to","LazyTensor",".","default_device","(","Optional","[","Union","[","torch.device",",","str",",","int","]","]",",","optional",")",":","Defalt","device","for","initialization",".","If","it","'s","cuda",",","initilization","will","be","accelerated",",","but","cuda","memory","will","be","allocated",".","By","default",",","it","'s","cpu",".","Defaults","to","None","."]
docstr: Initialize all ``Parameter`` from ``LazyTensor``. This function will modify the module in-place.
  
  Args:
      module (nn.Module): Target ``nn.Module``
      verbose (bool): Whether to print lazy initialization rate. Defaults to False.
docstr_tok: ["Initialize","all","``","Parameter","``","from","``","LazyTensor","``",".","This","function","will","modify","the","module","in-place",".","Args",":","module","(","nn.Module",")",":","Target","``","nn.Module","``","verbose","(","bool",")",":","Whether","to","print","lazy","initialization","rate",".","Defaults","to","False","."]
code: def materialize(
      module: nn.Module, verbose: bool = False
  ) -> nn.Module:
      """Initialize all ``Parameter`` from ``LazyTensor``. This function will modify the module in-place.
  
      Args:
          module (nn.Module): Target ``nn.Module``
          verbose (bool): Whether to print lazy initialization rate. Defaults to False.
      """
  
      def apply_fn(name: str, p: LazyTensor):
          p.materialize()
  
      return _apply_to_lazy_module(module, apply_fn, verbose)
  
imports: from types import MethodType
  from typing import Callable, Optional, Union
  import torch
  import torch.nn
  from packaging import version
  from torch import Tensor
  from torch.nn import Parameter
  from torch.utils._pytree import tree_map
  from colossalai.logging import get_dist_logger
  from .construction import ConstructorManager
  from .pretrained import PretrainedManager
  import colossalai._analyzer._subclasses._meta_registration
label_desc: Use image node_id 4 for calling the LazyInitContext obj's underlying member method code with example usage: obj.materialize(module, verbose) and returns: _apply_to_lazy_module