Doron Adler commited on
Commit
c359cbc
1 Parent(s): 5ab52c6

Fixed a crash when running on CPU and a custom seed was set

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -42,7 +42,12 @@ def inference(prompt, guidance, steps, width=512, height=512, seed=0, img=None,
42
  if torch.cuda.is_available():
43
  generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
44
  else:
45
- generator = torch.Generator.manual_seed(seed) if seed != 0 else None
 
 
 
 
 
46
 
47
  try:
48
  if img is not None:
 
42
  if torch.cuda.is_available():
43
  generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
44
  else:
45
+ if seed != 0:
46
+ torch.manual_seed(seed)
47
+ generator = torch.Generator()
48
+ generator.manual_seed(seed)
49
+ else:
50
+ generator = None
51
 
52
  try:
53
  if img is not None: