-
Hello, I am running some experiments with the Minirocket model (pytroch version) using the GPU. Is there a way to make the generation of the features deterministic? Every time I call Minirocket get_minirocket_features() with a fixed dataset I get slightly different features, which makes it hard to do proper benchmarking. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
oguiza
Apr 18, 2023
Replies: 1 comment
-
Hi @Arderiu, from fastai.torch_core import set_seed
set_seed(123, reproducibility=True) before you instantiate the model or learner. Here's the code set_seed uses: def set_seed(s, reproducible=False):
"Set random seed for `random`, `torch`, and `numpy` (where available)"
try: torch.manual_seed(s)
except NameError: pass
try: torch.cuda.manual_seed_all(s)
except NameError: pass
try: np.random.seed(s%(2**32-1))
except NameError: pass
random.seed(s)
if reproducible:
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Arderiu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Arderiu,
You can try it using:
before you instantiate the model or learner.
Here's the code set_seed uses: