worker ¶
Classes¶
fastvideo.worker.Executor ¶
Executor(fastvideo_args: FastVideoArgs, *, log_queue=None)
Bases: ABC
Source code in fastvideo/worker/executor.py
Methods:¶
fastvideo.worker.Executor.clear_log_queue abstractmethod ¶
fastvideo.worker.Executor.collective_rpc abstractmethod ¶
collective_rpc(method: str | Callable[..., _R], timeout: float | None = None, args: tuple = (), kwargs: dict[str, Any] | None = None) -> list[_R]
Execute an RPC call on all workers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method | str | Callable[..., _R] | Name of the worker method to execute, or a callable that is serialized and sent to all workers to execute. If the method is a callable, it should accept an additional | required |
timeout | float | None | Maximum time in seconds to wait for execution. Raises a :exc: | None |
args | tuple | Positional arguments to pass to the worker method. | () |
kwargs | dict[str, Any] | None | Keyword arguments to pass to the worker method. | None |
Returns:
| Type | Description |
|---|---|
list[_R] | A list containing the results from each worker. |
Note
It is recommended to use this API to only pass control messages, and set up data-plane communication to pass data.
Source code in fastvideo/worker/executor.py
fastvideo.worker.Executor.merge_lora_weights abstractmethod ¶
fastvideo.worker.Executor.set_log_queue abstractmethod ¶
set_log_queue(log_queue: Queue | None) -> None
Forward worker logs to the given queue. Call before generate_video.
fastvideo.worker.Executor.set_lora_adapter abstractmethod ¶
set_lora_adapter(lora_nickname: str, lora_path: str | None = None, strength: float = 1.0, accumulate: bool = False) -> None
Set the LoRA adapter for the workers.
fastvideo.worker.Executor.shutdown abstractmethod ¶
fastvideo.worker.Executor.unmerge_lora_weights abstractmethod ¶
fastvideo.worker.MultiprocExecutor ¶
MultiprocExecutor(fastvideo_args: FastVideoArgs, *, log_queue=None)
Bases: Executor
Source code in fastvideo/worker/executor.py
Methods:¶
fastvideo.worker.MultiprocExecutor.__del__ ¶
fastvideo.worker.MultiprocExecutor.__enter__ ¶
fastvideo.worker.MultiprocExecutor.__exit__ ¶
fastvideo.worker.MultiprocExecutor.clear_log_queue ¶
fastvideo.worker.MultiprocExecutor.set_log_queue ¶
Forward worker logs to the given queue. Call before generate_video.
fastvideo.worker.MultiprocExecutor.shutdown ¶
Properly shut down the executor and its workers
Source code in fastvideo/worker/multiproc_executor.py
Functions:¶
fastvideo.worker.initialize_ray_cluster ¶
initialize_ray_cluster(fastvideo_args: FastVideoArgs, ray_address: str | None = None)
Initialize the distributed cluster with Ray.
it will connect to the Ray cluster and create a placement group for the workers, which includes the specification of the resources for each distributed worker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parallel_config | The configurations for parallel execution. | required | |
ray_address | str | None | The address of the Ray cluster. If None, uses the default Ray cluster address. | None |
Source code in fastvideo/worker/ray_utils.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |