class_docstr: Contains the compute environment. If not passed, will try to detect.
  
  Args:
      dist_env: The distributed environment (distributed worldsize and global rank)
      worker_env: The worker environment (number of workers, worker rank)
class_docstr_tok: ["Contains","the","compute","environment",".","If","not","passed",",","will","try","to","detect",".","Args",":","dist_env",":","The","distributed","environment","(","distributed","worldsize","and","global","rank",")","worker_env",":","The","worker","environment","(","number","of","workers",",","worker","rank",")"]
docstr: Generates the Environment class by already given arguments instead of detecting them.
  
  Args:
      dist_world_size: The worldsize used for distributed training (=total number of distributed processes)
      global_rank: The distributed global rank of the current process
      num_workers: The number of workers per distributed training process
      current_worker_rank: The rank of the current worker within the number of workers of
          the current training process
docstr_tok: ["Generates","the","Environment","class","by","already","given","arguments","instead","of","detecting","them",".","Args",":","dist_world_size",":","The","worldsize","used","for","distributed","training","(","=total","number","of","distributed","processes",")","global_rank",":","The","distributed","global","rank","of","the","current","process","num_workers",":","The","number","of","workers","per","distributed","training","process","current_worker_rank",":","The","rank","of","the","current","worker","within","the","number","of","workers","of","the","current","training","process"]
code: def from_args(
      cls,
      dist_world_size: int,
      global_rank: int,
      num_workers: int,
      current_worker_rank: int,
  ) -> "Environment":
      """Generates the Environment class by already given arguments instead of detecting them.
  
      Args:
          dist_world_size: The worldsize used for distributed training (=total number of distributed processes)
          global_rank: The distributed global rank of the current process
          num_workers: The number of workers per distributed training process
          current_worker_rank: The rank of the current worker within the number of workers of
              the current training process
  
      """
      dist_env = _DistributedEnv(dist_world_size, global_rank)
      worker_env = _WorkerEnv(num_workers, current_worker_rank)
      return cls(dist_env=dist_env, worker_env=worker_env)
  
file_path: pytorch-lightning/src/lightning/data/utilities/env.py
imports: from typing import Callable, Optional
  import torch
  from torch.utils.data import get_worker_info
label_desc: Use image node_id 2 for calling the Environment obj's underlying member method code with example usage: obj.from_args(cls, dist_world_size, global_rank, num_workers, current_worker_rank) and returns: cls