Skip to content
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

TRT support for MAISI #701

Open
wants to merge 23 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
93a4dc5
Added trt_compile configs for vista2d and vista3d
borisfom Aug 28, 2024
c401a63
Merge branch 'dev' of github.com:Project-MONAI/model-zoo into vista_trt
borisfom Sep 4, 2024
89dfac1
Stash
borisfom Sep 6, 2024
c1ab420
Merge branch 'dev' into maisi-trt
borisfom Oct 9, 2024
027f71b
Merge remote-tracking branch 'origin/dev' into maisi-trt
borisfom Oct 9, 2024
b6628fc
Working MAISI
borisfom Oct 12, 2024
860b932
Merge remote-tracking branch 'origin/dev' into maisi-trt
borisfom Oct 16, 2024
e91ad57
Adding TRT support
borisfom Oct 16, 2024
b336e06
cleanup
borisfom Oct 16, 2024
97d2b0e
fixing condition
borisfom Oct 16, 2024
60000df
Added output_lists option
borisfom Oct 21, 2024
ebb50bc
update pre commit config
yiheng-wang-nv Oct 22, 2024
74a6ecc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 22, 2024
a9a8b03
update metadata
yiheng-wang-nv Oct 22, 2024
e827f5c
Addressing code review comments
borisfom Oct 22, 2024
76f8fb6
Merge remote-tracking branch 'origin/dev' into maisi-trt
borisfom Oct 30, 2024
26c0cae
Merge branch 'dev' into maisi-trt
borisfom Nov 8, 2024
42fa00c
Removing dynamo repro
borisfom Nov 13, 2024
94a45e0
Merge branch 'maisi-trt' of github.com:borisfom/model-zoo into maisi-trt
borisfom Nov 13, 2024
b4aefe0
Merge remote-tracking branch 'origin/dev' into maisi-trt
borisfom Nov 13, 2024
938b6a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 13, 2024
658e4f5
Fixing c_trt_args
borisfom Nov 15, 2024
fbfecd7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.8
python: python3

ci:
autofix_prs: true
Expand Down
4 changes: 2 additions & 2 deletions models/maisi_ct_generative/configs/inference.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"spatial_dims": 3,
"image_channels": 1,
"latent_channels": 4,
"output_size_xy": 512,
borisfom marked this conversation as resolved.
Show resolved Hide resolved
"output_size_z": 512,
"output_size_xy": 256,
"output_size_z": 256,
"output_size": [
"@output_size_xy",
"@output_size_xy",
Expand Down
17 changes: 17 additions & 0 deletions models/maisi_ct_generative/configs/inference_trt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"+imports": [
"$from monai.networks import trt_compile"
],
"c_trt_args": {
"output_lists": [
[
-1
],
[
0
]
]
},
"controlnet": "$trt_compile(@controlnet_def.to(@device), @trained_controlnet_path, args=@c_trt_args)",
"diffusion_unet": "$trt_compile(@diffusion_unet_def.to(@device), @trained_diffusion_path)"
}
3 changes: 2 additions & 1 deletion models/maisi_ct_generative/configs/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_generator_ldm_20240318.json",
"version": "0.4.5",
"version": "0.4.6",
"changelog": {
"0.4.6": "add TensorRT support",
"0.4.5": "update README",
"0.4.4": "update issue for IgniteInfo",
"0.4.3": "remove download large files, add weights_only when loading weights and add label_dict to large files",
Expand Down
1 change: 0 additions & 1 deletion models/maisi_ct_generative/scripts/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ def ldm_conditional_sample_one_image(
# synthesize latents
noise_scheduler.set_timesteps(num_inference_steps=num_inference_steps)
for t in tqdm(noise_scheduler.timesteps, ncols=110):
# Get controlnet output
borisfom marked this conversation as resolved.
Show resolved Hide resolved
down_block_res_samples, mid_block_res_sample = controlnet(
x=latents, timesteps=torch.Tensor((t,)).to(device), controlnet_cond=controlnet_cond_vis
)
Expand Down
Loading