Spaces:
Sleeping
Sleeping
Smithjohny376
commited on
Commit
·
da6a9a9
1
Parent(s):
339e95f
Create Random seed hopefully
Browse files- Random seed hopefully +10 -0
Random seed hopefully
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
random.seed(seed)
|
3 |
+
np.random.seed(seed)
|
4 |
+
if is_torch_available():
|
5 |
+
torch.manual_seed(seed)
|
6 |
+
torch.cuda.manual_seed_all(seed)
|
7 |
+
# ^^ safe to call this function even if cuda is not available
|
8 |
+
if is_tf_available():
|
9 |
+
tf.random.set_seed(seed)
|
10 |
+
|