-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vb/imagesource #221
Vb/imagesource #221
Conversation
…o work on cpu/gpu
…ault_tensor_type (dangerous)
…memory as it does not work for CPU case
Hey @vineetbansal , this looks wild! Please let me know when I should start reviewing this PR, I expect it will take some time to review :) |
Hi @adamlerer. I think the introduction of an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super cool! So many useful improvements being worked on here. I'm going to split the review into smaller chunks since there's so much to get through.
I'm seeing a lot of complexity and dangerous code in here that looks like it's the result of a premature optimization around doing the FFT in-place on CPU? I think you just want to do the FFT on the GPU on the current batches, and don't worry about in-place. That's something I'd be interested in discussing if there's another way to accomplish this goal.
…ot return copy of data for ArraySource
Btw, the use of I think we should default |
Fair point. |
Data Shuffler
require_adjacent argument for DataShuffler's use
A couple of tests for require_contiguous
I'm starting this new PR (not quite there yet, but close) that demonstrates a new
cryodrgn.source.ImageSource
class that should simplify calling code quite a bit.tests/test_source.py is a good place to see how to use this. The basic idea is:
For utilizing this during training:
Quite a few refactorings have been done in
cryodrgn
already to use this new functionality, but I'm certain there are more, and till the test coverage reaches close to 100% and I'm certain I haven't overlooked any scripts/utilities, I will keep this is draft mode.We're now also using
torch.Tensor
for all image data throughout our code (except a few places where saving to.pkl
or.mrc
files), andtorch.fft
for all FFT functions.A large number of changes in the code have to do with the fact that trying to use
torch.Tensor
/torch.fft
by default would not have worked without these changes, because the codebase was assumingnp.arrays
at lots of places.There is hardly any documentation, and I need to address some newly introduced
pyright
complaints too.Performance on lazy/eager datasets is comparable to the old implementation (actually just slightly faster). This is unsurprising because while the new API makes it easier for us to implement chunking, we haven't (yet) changed any logic to do so. I'll add some performance graphs to this PR as we proceed through the chunking logic.
Todo before merge:
TxtFileSource
to inherit from_MRCDataFrameSource
--num-workers 1
default everywhere--max-threads
argument intrain_vae
- decide whether to always use 1 thread, or keep the argument and change comment from FFT threads to data-loading threads.