rdinnager / styleganr

R implementation of StyleGAN3 (https://github.com/NVlabs/stylegan3) using torch package
Other
2 stars 1 forks source link

Use new Lantern types to simplify objects handling. #2

Closed dfalbel closed 2 years ago

dfalbel commented 2 years ago

This is using the new lantern types to simplify a little object handling. Still a work in progress.

Missing:

dfalbel commented 2 years ago

@rdinnager Could you check if this works in your setup?

rdinnager commented 2 years ago

I'm testing locally now. To get the libraries to be built on CI, you need to make a commit with #build-libs somewhere in the commit message.

rdinnager commented 2 years ago

By the way, thanks for working on this! I was wondering whether the changes from the lantern-types branch would mean I would need to rewrite some parts of styleganr. I didn't expect you to do it for me, but it is much appreciated! I have kind of put this project on hold though until https://github.com/rdinnager/styleganr/issues/1 gets resolved on the torch side (please let me know if there is anything I can do to help with this). I tried your suggestion of writing C++ autograd functions, but so far haven't been able to get it to work. I think the original stylegan uses a lot of the features of the Python autograd API, which makes it difficult to properly translate to C++ (like calling an autograd function object within an autograd function to get doubly differentiable functions, which it seems you can't do in C++? or at least I can't figure out how). At this point I'm happy to wait for a fix to the R autograd API (but I know this is a tricky problem, so please don't feel pressure, I am in no hurry).

dfalbel commented 2 years ago

Thanks @rdinnager ! I think I solved the last issues.

Ok! It makes sense that writing the C++ version of the autograd stuff is quite complicated. It's high-priority to me to fix the leak in torch. I did a small investigation while in lantern-types and I think I found the culprit, I'll try to fix it soon.

dfalbel commented 2 years ago

Regarding the testing failures, this will land into the main branch really soon.

rdinnager commented 2 years ago

Thanks @dfalbel! Wonderful! I've just switched back to using feature/install-headers in DESCRIPTION since I noticed you merged feature/lantern-types into that, so I could test the build, but good to hear it will be on the main branch soon!