Skip to content

Commit

Permalink
WIP:Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Demirrr committed Oct 4, 2024
1 parent 943a8f8 commit a43b3fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions dicee/models/clifford.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 2 additions & 1 deletion dicee/models/function_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dicee/models/pykeen_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a43b3fb

Please sign in to comment.