The linked documentation mentions all necessary steps to make the code reproducible.
If your model is using a non-deterministic method and thus raises an error after setting torch.use_deterministic_algorithms(True), you could either try to implement a (slow, but) deterministic approach or try to use the CPU implementation, if absolute necessary. Note that especially the second approach would synchronize the code due to the data transfer and could slow down your code significantly and I would only recommend to use it during debugging.