Questions about how to run multi_object_edit.py on two GPUs
RainbowZhuu opened this issue · 1 comments
Great work and thank you for publishing the code!
I have a question that how to run multi_object_edit.py on two GPUs?
Thank you!
Thank you for your question! There are two processes that can be accelerated: Figure 3 (b) (Optimal Inversion Step Searching) and Figure 3 (c) (Object-aware Inversion and Reassembly) in the paper. This is a complex engineering problem. In my original code, I save all candidate images to files and continuously check if they have all been generated before proceeding, but this is not elegant.
I suggest a more elegant design method:
- Deploy the "Optimal Inversion Step Searching" and "Object-aware Inversion and Reassembly" (before reassembly) for different editing pairs on multiple "editing pair GPUs".
- Use a "main GPU" to check whether the process in step 1 is complete and to get results from the "editing pair GPUs".
- Finally, use the "main GPU" to implement "Object-aware Inversion and Reassembly" (after reassembly).
To ensure the elegance of this code, I only implemented the scenario for a single GPU. To enable multi-GPU scenarios, simply deploy the editing pairs in for
loop onto different devices(or different processes).
"Optimal Inversion Step Searching": https://github.com/aim-uofa/OIR/blob/main/multi_object_edit.py#L50
"Object-aware Inversion and Reassembly"(before reassembly): https://github.com/aim-uofa/OIR/blob/main/utils/oir.py#L79