berenslab / t-simcne

Unsupervised visualization of image datasets using contrastive learning
https://t-simcne.readthedocs.io/en/latest/
115 stars 12 forks source link

Default behavior of use_ffcv is leading to an error #5

Closed KonstantinWilleke closed 11 months ago

KonstantinWilleke commented 11 months ago

When trying to run the example script, I get the following error:

        if self.use_ffcv:
            try:
                import ffcv

                ffcv.transforms.RandomGrayscale
            except ModuleNotFoundError:
                raise ValueError(
                    "`use_ffcv` is not False, but `ffcv` is not installed. "
                    "Install https://github.com/facebookresearch/FFCV-SSL"
                )

the requirements of t-simcne do not contain the ffcv package. When it is not installed, the default behavior of use_ffcv='auto' will lead to the ValueErrr being thrown. So I'd suggest to either include ffcv as a requirement, or set the default of use_ffcv=auto to not using ffcv when it is not installed.

jnboehm commented 11 months ago

Ah, good catch. This happens because the value of self.use_ffcv is "auto" there, so the if condition is true. I've fixed that logic bug.

I would like to not have ffcv as a strict dependency because it turns out to be quite difficult to install (due to non-python packages). Weirdly enough the conda solver also just fails to install them, hence I want to not require ffcv.