Skip to content

Conversation

@hum-ma
Copy link

@hum-ma hum-ma commented Jan 12, 2026

I noticed there already were functions for setting autocast dtype depending on GPU capability. However, they were restricted to compute major version >= 7 whereas my GPU with compute 5.2 can also run models in float16, and in fact it is the only way to run SAM3 because it crashes with OOM if loading in float32 with 4 GB VRAM. I don't know if compute 6.x devices are good with float16 so the detection rule could be tuned further if they have problems.

I moved dtype detection into load_model, save it with the sam3_model and subsequently use it to autocast accordingly. Loading the video model with .half() is the key change to reduce memory use, but the autocasts are necessary to prevent tensor type mismatch errors during processing. I hope I caught them for all use cases...

The interactive detection dialog doesn't use the same loaded model so I added separate detection for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant