Reset seed in pytorch

I just set torch seed to 0 with torch.manual_seed, Is there any way to reset the seed.

my case was, I wanted to generate a fixed random tensor, without affecting the randomness of others(other tensors should be different each time).

I found a context manager in torchfunc module, but I don’t have access to it in HuggingFace

You can use torch.random.get_rng_state() and torch.random.set_rng_state(prev_state). See torch.random — PyTorch 1.7.0 documentation for docs.

Another option is to use NumPy to generate your random fixed tensor.

random_fixed_tensor = torch.as_tensor(np.random.normal(...))