worker_base
¶
Classes¶
fastvideo.worker.worker_base.WorkerWrapperBase
¶
WorkerWrapperBase(fastvideo_args: FastVideoArgs, rpc_rank: int = 0)
This class represents one process in an executor/engine. It is responsible
for lazily initializing the worker and handling the worker's lifecycle.
We first instantiate the WorkerWrapper, which remembers the worker module
and class name. Then, when we call update_environment_variables, and the
real initialization happens in init_worker.
Initialize the worker wrapper with the given fastvideo_args and rpc_rank. Note: rpc_rank is the rank of the worker in the executor. In most cases, it is also the rank of the worker in the distributed group. However, when multiple executors work together, they can be different. e.g. in the case of SPMD-style offline inference with TP=2, users can launch 2 engines/executors, each with only 1 worker. All workers have rpc_rank=0, but they have different ranks in the TP group.
Source code in fastvideo/worker/worker_base.py
Functions¶
fastvideo.worker.worker_base.WorkerWrapperBase.adjust_rank
¶
Adjust the rpc_rank based on the given mapping. It is only used during the initialization of the executor, to adjust the rpc_rank of workers after we create all workers.
Source code in fastvideo/worker/worker_base.py
fastvideo.worker.worker_base.WorkerWrapperBase.init_worker
¶
Here we inject some common logic before initializing the worker. Arguments are passed to the worker class constructor.