diff --git a/dicee/models/clifford.py b/dicee/models/clifford.py index 570090f7..196aba72 100644 --- a/dicee/models/clifford.py +++ b/dicee/models/clifford.py @@ -1,7 +1,5 @@ from .base_model import BaseKGE import torch -from torch.nn import functional as F -from torch import nn class CMult(BaseKGE): diff --git a/dicee/models/function_space.py b/dicee/models/function_space.py index fc991ac1..57bfa6f1 100644 --- a/dicee/models/function_space.py +++ b/dicee/models/function_space.py @@ -18,7 +18,6 @@ def __init__(self, args): self.gamma = torch.randn(self.k, self.num_sample) # N(0,1) # Lazy import from scipy.special import roots_legendre - from scipy.special import roots_legendre roots, weights = roots_legendre(self.num_sample) self.roots = torch.from_numpy(roots).repeat(self.k, 1).float() # shape self.k by self.n self.weights = torch.from_numpy(weights).reshape(1, -1).float() # shape 1 by self.n @@ -81,6 +80,8 @@ def __init__(self, args): self.param_init(self.entity_embeddings.weight.data), self.param_init(self.relation_embeddings.weight.data) self.k = int(np.sqrt(self.embedding_dim // 2)) self.num_sample = 250 + # Lazy import + from scipy.special import roots_legendre roots, weights = roots_legendre(self.num_sample) self.roots = torch.from_numpy(roots).repeat(self.k, 1).float() # shape self.k by self.n self.weights = torch.from_numpy(weights).reshape(1, -1).float() # shape 1 by self.n diff --git a/dicee/models/pykeen_models.py b/dicee/models/pykeen_models.py index e2aeacdb..7c218691 100644 --- a/dicee/models/pykeen_models.py +++ b/dicee/models/pykeen_models.py @@ -57,7 +57,7 @@ def __init__(self, args: dict): try: # lazy import from pykeen.models import model_resolver - except: + except ImportError: print(traceback.format_exc()) print("Pykeen does not work with pytorch>2.0.0. Current pytorch version:",torch.__version__) exit(1)