MCPcopy Create free account
hub / github.com/Netflix/void-model / MultiNodesEngine

Class MultiNodesEngine

videox_fun/api/api_multi_nodes.py:156–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154 raise HTTPException(status_code=500, detail=str(e))
155
156 class MultiNodesEngine:
157 def __init__(
158 self,
159 world_size,
160 Controller,
161 GPU_memory_mode,
162 scheduler_dict,
163 model_name,
164 model_type,
165 config_path,
166 ulysses_degree,
167 ring_degree,
168 enable_teacache,
169 teacache_threshold,
170 num_skip_start_steps,
171 teacache_offload,
172 weight_dtype,
173 savedir_sample
174 ):
175 # Ensure Ray is initialized
176 if not ray.is_initialized():
177 ray.init()
178
179 num_workers = world_size
180 self.workers = [
181 MultiNodesGenerator.remote(
182 rank, world_size, Controller,
183 GPU_memory_mode, scheduler_dict, model_name=model_name, model_type=model_type, config_path=config_path,
184 ulysses_degree=ulysses_degree, ring_degree=ring_degree, enable_teacache=enable_teacache, teacache_threshold=teacache_threshold, num_skip_start_steps=num_skip_start_steps,
185 teacache_offload=teacache_offload, weight_dtype=weight_dtype, savedir_sample=savedir_sample,
186 )
187 for rank in range(num_workers)
188 ]
189 print("Update workers done")
190
191 async def generate(self, data):
192 results = ray.get([
193 worker.generate.remote(data)
194 for worker in self.workers
195 ])
196
197 return next(path for path in results if path is not None)
198
199 def multi_nodes_infer_forward_api(_: gr.Blocks, app: FastAPI, engine):
200

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected