-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Describe the bug
When attempting to export a fine-tuned micro-sam model to the BioImage.IO format using the export_sam_model function on Windows 10, a RuntimeError is raised. This appears to be due to a missing pre-compiled kernel in the PyTorch Windows build for a specific upsampling operation on 'Byte' (uint8) data types. The process works as expected on Linux.
To Reproduce
- Set up a micro-sam environment on Windows 10 using conda from conda-forge.
- Install micro-sam version 1.6.1 and a recent PyTorch build (e.g., 2.7.1 with CUDA).
- Execute a script that calls the export_sam_model function with a uint8 image as input.
Error Log
The script fails with the following RuntimeError:
...
File ...\site-packages\torch\nn\functional.py:4678, in interpolate(input, size, scale_factor, mode, align_corners, recompute_scale_factor, antialias)
4676 assert align_corners is not None
4677 if antialias:
-> 4678 return torch._C._nn._upsample_bilinear2d_aa(
4679 input, output_size, align_corners, scale_factors
4680 )
...
RuntimeError: "upsample_bilinear2d_out_frame" not implemented for 'Byte'
Workaround
I have confirmed that the same script runs without any issues in a Linux environment (WSL Ubuntu) with a comparable PyTorch version. This suggests the necessary kernel for this operation is available in the Linux PyTorch builds but not in the Windows ones. I thought it will be useful report in case somebody hits into the same issue.
Environment
- OS: Windows 10
- pytorch version: 2.7.1 (installed via conda from conda-forge)
- micro-sam version: 1.6.1
- GPU: NVIDIA GeForce RTX 5090
- CUDA version: 12.9