Elron commited on
Commit
4b1b61a
1 Parent(s): dd4158e

Upload random_utils.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. random_utils.py +5 -4
random_utils.py CHANGED
@@ -1,13 +1,14 @@
1
  import hashlib
2
  import random as python_random
 
3
 
4
- __default_seed__ = 42
5
 
6
- from typing import Any, Hashable
7
 
8
 
9
  def get_seed():
10
- return __default_seed__
11
 
12
 
13
  def new_random_generator(sub_seed: Any) -> python_random.Random:
@@ -30,5 +31,5 @@ def new_random_generator(sub_seed: Any) -> python_random.Random:
30
  # for Hashable objects that are not strings
31
  sub_seed = str(hash(sub_seed))
32
 
33
- sub_default_seed = str(__default_seed__) + "/" + sub_seed
34
  return python_random.Random(sub_default_seed)
 
1
  import hashlib
2
  import random as python_random
3
+ from typing import Any, Hashable
4
 
5
+ from .settings_utils import get_settings
6
 
7
+ settings = get_settings()
8
 
9
 
10
  def get_seed():
11
+ return settings.seed
12
 
13
 
14
  def new_random_generator(sub_seed: Any) -> python_random.Random:
 
31
  # for Hashable objects that are not strings
32
  sub_seed = str(hash(sub_seed))
33
 
34
+ sub_default_seed = str(settings.seed) + "/" + sub_seed
35
  return python_random.Random(sub_default_seed)