Skip to content

Commit

Permalink
Fix multi-process dataloader with same random seeds during epochs
Browse files Browse the repository at this point in the history
  • Loading branch information
LutaoChu authored Jul 9, 2021
1 parent 1798a3e commit 0adef44
Showing 1 changed file with 2 additions and 2 deletions.
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))

0 comments on commit 0adef44

Please sign in to comment.