question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The question of fix_random_seed

See original GitHub issue

hi, recently I want to reproduce the provided result of usr’s, the usr’s result is obtained by training 20 epochs with pv_rcnn. When I trained 20 epochs and then tested the result, which is not inconsistent with usr’s. I think the reason the that not set fix_random_seed=True , so the usr re-train the model with fix_random_seed=True and get the new result. But the result is also inconsistent with my re-trained results by setting fix_random_seed=True. Then I check the source code of common_utils.set_random_seed, I found that it did not set torch.cuda.manual_seed(seed).

def set_random_seed(seed):
    random.seed(seed)
    np.random.seed(seed)
    torch.manual_seed(seed)
    torch.backends.cudnn.deterministic = True
    torch.backends.cudnn.benchmark = False

According to pytorch official, it may be need to set torch.cuda.manual_seed(seed). could you please help me analyze that this is the reason to cause the inconsistent result? Thank you very much!!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
sshaoshuaicommented, Oct 21, 2020

@wuyujiji I think “needs discussion” means this problem needs more discussions from more users who have some experiences about it, and it doesn’t mean that I was those people. Besides, I have tried to fix the seed for several times and many strategies before, but nothing works.

1reaction
wuyujijicommented, Oct 21, 2020

@sshaoshuai Excuse me! could you please share me how long will you disucess about this question? this problem blocks my project progress!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing random seed on inference - Cross Validated
I will be deploying models into production and I'm wondering whether it is appropriate to fix the random number generator seed at inference...
Read more >
random.seed(): What does it do? - Stack Overflow
Pseudo-random number generators work by performing some operation on a value. Generally this value is the previous number generated by the generator.
Read more >
No way to fix the random seed? · Issue #157 · sdv-dev/SDV
I'd like to set up some tests for the generated data in my project but I can't see any way to fix the...
Read more >
Random Seeds and Reproducibility - Towards Data Science
Often, you'll see that the chosen random seed is 42, the (second) least random of all random seeds one could possibly choose.
Read more >
random.seed( ) in Python - GeeksforGeeks
Seed function is used to save the state of a random function, so that it can generate same random numbers on multiple executions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found