Spaces:
Sleeping
Sleeping
zhzluke96
commited on
Commit
•
0129fb6
1
Parent(s):
353b2e3
update
Browse files- modules/utils/SeedContext.py +6 -1
- requirements.txt +2 -1
modules/utils/SeedContext.py
CHANGED
@@ -56,7 +56,12 @@ class SeedContext:
|
|
56 |
def __enter__(self):
|
57 |
self.state = (torch.get_rng_state(), random.getstate(), np.random.get_state())
|
58 |
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
def __exit__(self, exc_type, exc_value, traceback):
|
62 |
torch.set_rng_state(self.state[0])
|
|
|
56 |
def __enter__(self):
|
57 |
self.state = (torch.get_rng_state(), random.getstate(), np.random.get_state())
|
58 |
|
59 |
+
try:
|
60 |
+
deterministic(self.seed)
|
61 |
+
except Exception as e:
|
62 |
+
raise ValueError(
|
63 |
+
f"Seed must be an integer, but: <{type(self.seed)}> {self.seed}"
|
64 |
+
)
|
65 |
|
66 |
def __exit__(self, exc_type, exc_value, traceback):
|
67 |
torch.set_rng_state(self.state[0])
|
requirements.txt
CHANGED
@@ -22,4 +22,5 @@ gradio
|
|
22 |
emojiswitch
|
23 |
python-dotenv
|
24 |
zhon
|
25 |
-
mistune
|
|
|
|
22 |
emojiswitch
|
23 |
python-dotenv
|
24 |
zhon
|
25 |
+
mistune==3.0.2
|
26 |
+
cn2an
|