Skip to content

Instantly share code, notes, and snippets.

@prerakmody
Last active January 18, 2025 15:50
Show Gist options
  • Save prerakmody/3dd65eae6e05e64d8a218999a42b47aa to your computer and use it in GitHub Desktop.
Save prerakmody/3dd65eae6e05e64d8a218999a42b47aa to your computer and use it in GitHub Desktop.
UV - fast Python package installer and resolver
"""
>> pip install uv # OR https://docs.astral.sh/uv/getting-started/installation/
>> uv run -p 3.11 uv-monai-torchsummary.py
"""
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "monai==1.3.2",
# "torchsummary==1.5.1",
# ]
# ///
import monai # v1.3.2
import torchsummary # v1.5.1
model = monai.networks.nets.UNet(in_channels=2, out_channels=1, spatial_dims=3, channels=[16, 32, 64, 128], strides=[2, 2, 2], num_res_units=2)
torchsummary.summary(model.cuda(), (2, 144, 144, 144))
print ('\n\n =========================== \n\n')
model = monai.networks.nets.UNet(in_channels=5, out_channels=1, spatial_dims=3, channels=[16, 32, 64, 128], strides=[2, 2, 2], num_res_units=2)
torchsummary.summary(model.cuda(), (5, 144, 144, 144))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment