lightly-ai / lightly

A python library for self-supervised learning on images.
https://docs.lightly.ai/self-supervised-learning/
MIT License
3.09k stars 264 forks source link

Fix examples on Windows #1512

Open guarin opened 7 months ago

guarin commented 7 months ago

We sometimes use lambdas in the examples when creating torch datasets: https://github.com/lightly-ai/lightly/blob/e7f13a53e68031ee0ae77124e76401b48381001f/examples/pytorch/mae.py#L87

This results in issues on Windows as lambdas cannot be pickled. We should update the examples and replace the lambdas with pickleable functions.

snehilchatterjee commented 1 day ago

From my understanding, the goal is to replace the lambda functions with picklable functions because lambda functions, being anonymous, cannot be pickled. Therefore, am I correct in assuming that we need to convert the lambda functions into named functions?

guarin commented 1 day ago

Yes, something like this should work:

def target_transform(t):
    return 0
snehilchatterjee commented 1 day ago

then I'd be happy to work on this. can you assign this issue to me ?