Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multi-process dataloader with same random seeds during epochs #1113

Merged
merged 1 commit into from
Jul 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions paddleseg/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

import contextlib
import filelock
import math
import os
import tempfile
import numpy as np
import random
from urllib.parse import urlparse, unquote

import paddle
Expand Down Expand Up @@ -122,4 +122,4 @@ def resume(model, optimizer, resume_model):


def worker_init_fn(worker_id):
np.random.seed(np.random.get_state()[1][0] + worker_id)
np.random.seed(random.randint(0, 100000))