ml6team / fondant-usecase-controlnet

Example Fondant pipeline preparing data to train a Controlnet model
25 stars 3 forks source link

Add pipeline #1

Closed PhilippeMoussalli closed 1 year ago

PhilippeMoussalli commented 1 year ago

Add controlnet pipeline

RobbeSneyders commented 1 year ago

The notebook hangs after executing the pipeline? Did you run into this as well? image

PhilippeMoussalli commented 1 year ago

The notebook hangs after executing the pipeline? Did you run into this as well? image

For me it seems ok, could the next cell be the one that's hanging? image

RobbeSneyders commented 1 year ago

Seems like it hangs after the download_images component, while there's two more steps. I see yours ended after download_images?

RobbeSneyders commented 1 year ago

This is probably due to them being GPU components. I think they no longer work on CPU since we changed the base image.

PhilippeMoussalli commented 1 year ago

Seems like it hangs after the download_images component, while there's two more steps. I see yours ended after download_images?

I think it's because you don't have a gpu that's set but in the compose spec GPU is set, so it's probably not finding the hardware. Removing the GPU from the op should resolve it

RobbeSneyders commented 1 year ago

You're right, it's due to the GPU in the ComponentOp. Maybe we should comment those out in the notebook?

PhilippeMoussalli commented 1 year ago

You're right, it's due to the GPU in the ComponentOp. Maybe we should comment those out in the notebook?

The recommended way for this pipeline is to run it on a GPU (mentioned in the prerequisites) not sure if the model can properly load with a cpu in place.

RobbeSneyders commented 1 year ago

People don't read :stuck_out_tongue:

The components do work on cpu. We could do something like this:

import logging
import subprocess
try:
    subprocess.check_output('nvidia-smi')
    gpu = 1
except Exception:
    logging.warning("We recommend to run this pipeline on a GPU, but none could be found")
    gpu = 0
caption_images_op = ComponentOp.from_registry(
    name="caption_images",
    ...
    number_of_accelerators=gpu,
    accelerator_name="GPU",
)
segment_images_op = ComponentOp.from_registry(
    name="segment_images",
    ...
    number_of_accelerators=gpu,
    accelerator_name="GPU",
)
PhilippeMoussalli commented 1 year ago

People don't read 😛

The components do work on cpu. We could do something like this:

import logging
import subprocess
try:
    subprocess.check_output('nvidia-smi')
    gpu = 1
except Exception:
    logging.warning("We recommend to run this pipeline on a GPU, but none could be found")
    gpu = 0
caption_images_op = ComponentOp.from_registry(
    name="caption_images",
    ...
    number_of_accelerators=gpu,
    accelerator_name="GPU",
)
segment_images_op = ComponentOp.from_registry(
    name="segment_images",
    ...
    number_of_accelerators=gpu,
    accelerator_name="GPU",
)

Ok I think that makes the most sense :P will add it here and on datacomp