class_docstr: Distributed data parallel for ColoTensor. Nested ColoDDP is not supported now.
  
  Example:
      >>> from colossalai.legacy.core import global_context as gpc
      >>> from colossalai.legacy.context import ParallelMode
      >>> model = torch.nn.Linear(20, 1)
      >>> pg = ProcessGroup(tp_degree = world_size//2)
      >>> model = ColoDDP(model, pg)
      >>> logits = model(x)
      >>> loss = criterion(logits, labels)
      >>> model.backward(loss)
  
  Args:
      module (torch.nn.Module): Module to apply DDP.
      process_group (Optional[dist.ProcessGroup], optional): The process group which DDP uses.
          If it's None, the default data parallel group will be used. Defaults to None.
class_docstr_tok: ["Distributed","data","parallel","for","ColoTensor",".","Nested","ColoDDP","is","not","supported","now",".","Example",":",">",">",">","from","colossalai.legacy.core","import","global_context","as","gpc",">",">",">","from","colossalai.legacy.context","import","ParallelMode",">",">",">","model","=","torch.nn.Linear","(","20",",","1",")",">",">",">","pg","=","ProcessGroup","(","tp_degree","=","world_size\/\/2",")",">",">",">","model","=","ColoDDP","(","model",",","pg",")",">",">",">","logits","=","model","(","x",")",">",">",">","loss","=","criterion","(","logits",",","labels",")",">",">",">","model.backward","(","loss",")","Args",":","module","(","torch.nn.Module",")",":","Module","to","apply","DDP",".","process_group","(","Optional","[","dist.ProcessGroup","]",",","optional",")",":","The","process","group","which","DDP","uses",".","If","it","'s","None",",","the","default","data","parallel","group","will","be","used",".","Defaults","to","None","."]
docstr: Sets parameters to be ignored by DDP.
  This method must be called before initializing ColoDDP.
  
  Example:
      >>> params_to_ignore = []
      >>> for p in module.parameters():
      >>>     if should_ignore(p):
      >>>         params_to_ignore.append(p)
      >>> ColoDDP.set_params_to_ignore(params_to_ignore)
      >>> module = ColoDDP(module)
  
  Args:
      params_to_ignore (Iterable[torch.Tensor]): A list of parameters to be ignored.
docstr_tok: ["Sets","parameters","to","be","ignored","by","DDP",".","This","method","must","be","called","before","initializing","ColoDDP",".","Example",":",">",">",">","params_to_ignore","=","[","]",">",">",">","for","p","in","module.parameters","(",")",":",">",">",">","if","should_ignore","(","p",")",":",">",">",">","params_to_ignore.append","(","p",")",">",">",">","ColoDDP.set_params_to_ignore","(","params_to_ignore",")",">",">",">","module","=","ColoDDP","(","module",")","Args",":","params_to_ignore","(","Iterable","[","torch.Tensor","]",")",":","A","list","of","parameters","to","be","ignored","."]
code: def set_params_to_ignore(
      params_to_ignore: Iterable[torch.Tensor],
  ) -> None:
      """Sets parameters to be ignored by DDP.
      This method must be called before initializing ColoDDP.
  
      Example:
          >>> params_to_ignore = []
          >>> for p in module.parameters():
          >>>     if should_ignore(p):
          >>>         params_to_ignore.append(p)
          >>> ColoDDP.set_params_to_ignore(params_to_ignore)
          >>> module = ColoDDP(module)
  
      Args:
          params_to_ignore (Iterable[torch.Tensor]): A list of parameters to be ignored.
      """
      for p in params_to_ignore:
          p._ddp_to_ignore = True
  
imports: from collections import OrderedDict
  from functools import partial
  from typing import Iterable, Optional, Set
  import torch
  import torch.distributed
  from colossalai.legacy.tensor import ProcessGroup
  from colossalai.utils import is_ddp_ignored
  from .reducer import Reducer
label_desc: Use image node_id 12 for calling the ColoDDP obj's underlying member method code with example usage: obj.set_params_to_ignore(params_to_ignore) without return types