[quantization] Tune torch#703
Open
stamalakhov wants to merge 2 commits into
Open
Conversation
This PR tunes `torch` environment to improve reproducibility of results. TICO-DCO-1.0-Signed-off-by: s.malakhov <s.malakhov@partner.samsung.com>
mhs4670go
reviewed
May 13, 2026
| torch.utils.deterministic.fill_uninitialized_memory = True | ||
| torch.backends.cuda.matmul.allow_tf32 = False | ||
| torch.backends.cudnn.allow_tf32 = False | ||
| os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8" |
Contributor
There was a problem hiding this comment.
Could you move this environment variable setup before importing torch?
CUBLAS_WORKSPACE_CONFIG should be set before CUDA/cuBLAS is initialized. Since this script already imports torch before setting it in setup_runtime(), it is not fully clear whether the setting is always applied as intended.
I think it would be safer to move it near the top of the file, before import torch, and use setdefault() so that a user-provided value is not overwritten:
import argparse
import os
os.environ.setdefault("CUBLAS_WORKSPACE_CONFIG", ":4096:8")
import pathlib
import randomTICO-DCO-1.0-Signed-off-by: s.malakhov <s.malakhov@partner.samsung.com>
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.
This PR tunes
torchenvironment to improve reproducibility of results.Draft: #670
Related: #656
TICO-DCO-1.0-Signed-off-by: s.malakhov s.malakhov@partner.samsung.com