fix: conditional import torch

This commit is contained in:
adldotori 2023-04-03 12:42:08 +00:00
parent 0f4669ea36
commit 810a30fcfa

View File

@ -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