Add autocast sub-config to inference settings and disable torch.autocast by default#3105
Merged
MMathisLab merged 6 commits intomainfrom Oct 1, 2025
Merged
Add autocast sub-config to inference settings and disable torch.autocast by default#3105MMathisLab merged 6 commits intomainfrom
autocast sub-config to inference settings and disable torch.autocast by default#3105MMathisLab merged 6 commits intomainfrom
Conversation
autocast sub-config to inference settings and disable torch.autocast by default
Contributor
|
Thanks. Tested this with both autocast on and off. |
MMathisLab
approved these changes
Oct 1, 2025
This was referenced Oct 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This Pull Request builds on top of #3104 and #3098, adding a new
autocastsub-config to theinference:block of the PyTorch configuration.The use of
torch.autocastduring inference was first introduced in #3012 (“Shaokai/faster inference”)with the goal of improving inference speed.
However, we later discovered that enabling
torch.autocastcan significantly decrease inference accuracy — this is the root cause of issue #3083 and the forum discussion “Better results with DeepLabCut==2.3.0 than DeepLabCut==3.0 with PyTorch”.Key Changes
autocastsub-config in theinference:block ofpytorch_config.yaml.AutocastConfigclass to manage parameters consistently with the existingcompileandmultithreadingoptions.InferenceConfigobject or a dictionary), orpytorch_config.yamlfile under theinference:block.Notes & Future Work
torch.autocastcan mitigate this accuracy gap and allow safer use of autocast at inference.