mirror of
https://github.com/corca-ai/EVAL
synced 2024-10-30 09:20:44 +00:00
fix: conditional import torch
This commit is contained in:
parent
0f4669ea36
commit
810a30fcfa
10
utils.py
10
utils.py
@ -3,7 +3,6 @@ import random
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
|
||||||
|
|
||||||
os.makedirs("image", exist_ok=True)
|
os.makedirs("image", exist_ok=True)
|
||||||
os.makedirs("audio", exist_ok=True)
|
os.makedirs("audio", exist_ok=True)
|
||||||
@ -15,8 +14,13 @@ os.makedirs("playground", exist_ok=True)
|
|||||||
def seed_everything(seed):
|
def seed_everything(seed):
|
||||||
random.seed(seed)
|
random.seed(seed)
|
||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
torch.manual_seed(seed)
|
try:
|
||||||
torch.cuda.manual_seed_all(seed)
|
import torch
|
||||||
|
|
||||||
|
torch.manual_seed(seed)
|
||||||
|
torch.cuda.manual_seed_all(seed)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return seed
|
return seed
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user