-
Notifications
You must be signed in to change notification settings - Fork 6
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
[BUG] aten::max_pool3d_with_indices not implemented #326
Comments
Hi Conrad! Thanks a lot for giving it a go. It never clicked in my head that it was the max pool 3D, and we probably tested it using a 2D dataset... We will need to figure out a work around... In the error it states "As a temporary fix, you can set the environment variable Have you tried this?
|
Hi Joran, I haven't tried it, but because it kind of defeats the purpose... Obviously it is possible to run everything on CPU; what I'm interested in though is the ballpark of the time it would take to process different sized images on macOS. I took a quick look at the PyTorch issue for maxpool_3d_with_indices. Maybe I muster the motivation to give it a go over the holidays... |
My understanding of the flag is that it only runs that single operation on CPU (or any operation that is still not supported), not the whole training. I am not familiar with the It is on our todo list to test it out quantitatively, but the end of the year is a bit tough... |
Hi @conradkun, I have just taken the time to do a quick comparison of running 3D N2V on mac with only CPU vs MPS with To do this I ran the following script (use from pathlib import Path
import timeit
import tifffile
from careamics import CAREamist
from careamics.config import create_n2v_configuration
from careamics_portfolio import PortfolioManager
# instantiate data portfolio manage
portfolio = PortfolioManager()
# and download the data
root_path = Path("./data")
file = portfolio.denoising.Flywing.download(root_path)
train_image = tifffile.imread(file[0])
n_epochs = 1
config = create_n2v_configuration(
experiment_name="flywing_n2v",
data_type="array",
axes="ZYX",
patch_size=(16, 64, 64),
batch_size=2,
num_epochs=n_epochs,
augmentations=[], # remove augmentations
)
# train
n_repeats = 10
total_train_time = timeit.timeit(
lambda: CAREamist(source=config).train(
train_source=train_image,
val_percentage=0.0,
val_minimum_split=10, # use 10 patches as validation
),
number=n_repeats,
)
average_train_time = total_train_time/n_repeats
print(f"Average time taken to train {n_epochs} epoch(s): {average_train_time :.2f}s") For CPU only the print out was
For MPS with
This is still about a 4-fold speed-up so the overhead of transferring the tensors between the GPU and CPU doesn't seem too bad. Hopefully the MPS implementation of Let me know if you have any questions 😊 Specs |
And if anyone runs into that issue as well, and stumble upon that message, please thumb up the following message: pytorch/pytorch#77764 (comment) In the off-chance that it will push the operation up the priority list! |
Describe the bug
Unfortunately, I was able to reproduce the
mps
bug whereaten::max_pool3d_with_indices
is missing on macOS GPU acceleration. Indeed, this operation is shown as "In Process" in the PyTorch mps Ops tracker, meaning it is not implemented yet. This error seems to (understandably) only pop up when trying to process 3D images usingmps
on macOS.To Reproduce
I created a new environment from scratch, following the guidelines in the CAREamics installation guide.
Then I just tried to train on a 3D image, albeit one with a custom file extension (and hence custom
read_npy
function). I'll be happy to try with a.tiff
file if you point me to one.Code snippet allowing reproducing the behaviour:
Error message:
System
Important
Environment
The text was updated successfully, but these errors were encountered: