diff --git a/hyperbench/hlp/__init__.py b/hyperbench/hlp/__init__.py index 10c5751..ae4fe81 100644 --- a/hyperbench/hlp/__init__.py +++ b/hyperbench/hlp/__init__.py @@ -3,7 +3,7 @@ from .hgnn_hlp import HGNNHlpModule, HGNNEncoderConfig from .hnhn_hlp import HNHNEncoderConfig, HNHNHlpModule from .hgnnp_hlp import HGNNPEncoderConfig, HGNNPHlpModule -from .hlp import HlpModule +from .common import HlpModule from .hypergcn_hlp import HyperGCNHlpModule, HyperGCNEncoderConfig from .mlp_hlp import MLPHlpModule, MlpEncoderConfig from .node2vec_common import ( diff --git a/hyperbench/hlp/hlp.py b/hyperbench/hlp/common.py similarity index 100% rename from hyperbench/hlp/hlp.py rename to hyperbench/hlp/common.py diff --git a/hyperbench/hlp/common_neighbors_hlp.py b/hyperbench/hlp/common_neighbors_hlp.py index 921f251..e4d6724 100644 --- a/hyperbench/hlp/common_neighbors_hlp.py +++ b/hyperbench/hlp/common_neighbors_hlp.py @@ -1,5 +1,5 @@ import torch -import logging as log +import warnings from torch import Tensor, nn from typing import Literal, Optional @@ -8,7 +8,7 @@ from hyperbench.types import HData, Hypergraph from hyperbench.utils import Aggregation, Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule class CommonNeighborsHlpModule(HlpModule): @@ -57,9 +57,11 @@ def forward(self, hyperedge_index: Tensor) -> Tensor: def on_fit_start(self) -> None: """Warn users if they are running unnecessary training epochs.""" if self.trainer.max_epochs is None or self.trainer.max_epochs > 0: - log.warning( + warnings.warn( f"{self.__class__.__name__} is a non-trainable heuristic model. " - "No optimization occurs. Set max_epochs=0 in your trainer for instant evaluation." + "No optimization occurs. Set max_epochs=0 in your trainer for instant evaluation.", + UserWarning, + stacklevel=2, ) def training_step(self, batch: HData, batch_idx: int) -> Tensor: diff --git a/hyperbench/hlp/gcn_hlp.py b/hyperbench/hlp/gcn_hlp.py index a97ae6a..8e18cae 100644 --- a/hyperbench/hlp/gcn_hlp.py +++ b/hyperbench/hlp/gcn_hlp.py @@ -7,7 +7,7 @@ from hyperbench.types import EdgeIndex, HData, HyperedgeIndex from hyperbench.utils import ActivationFn, Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule class GCNEncoderConfig(TypedDict): diff --git a/hyperbench/hlp/hgnn_hlp.py b/hyperbench/hlp/hgnn_hlp.py index 24784e6..515e550 100644 --- a/hyperbench/hlp/hgnn_hlp.py +++ b/hyperbench/hlp/hgnn_hlp.py @@ -7,7 +7,7 @@ from torchmetrics import MetricCollection from hyperbench.utils import Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule class HGNNEncoderConfig(TypedDict): diff --git a/hyperbench/hlp/hgnnp_hlp.py b/hyperbench/hlp/hgnnp_hlp.py index 7ddfc36..89a171a 100644 --- a/hyperbench/hlp/hgnnp_hlp.py +++ b/hyperbench/hlp/hgnnp_hlp.py @@ -7,7 +7,7 @@ from hyperbench.types import HData from hyperbench.utils import Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule class HGNNPEncoderConfig(TypedDict): diff --git a/hyperbench/hlp/hnhn_hlp.py b/hyperbench/hlp/hnhn_hlp.py index b66d817..b64e7e0 100644 --- a/hyperbench/hlp/hnhn_hlp.py +++ b/hyperbench/hlp/hnhn_hlp.py @@ -1,15 +1,14 @@ from typing import Literal, Optional, TypedDict - from torch import Tensor, nn, optim from torchmetrics import MetricCollection from typing_extensions import NotRequired - -from hyperbench.hlp.hlp import HlpModule from hyperbench.models import HNHN, SLP from hyperbench.nn import HyperedgeAggregator from hyperbench.types import HData from hyperbench.utils import Stage +from hyperbench.hlp.common import HlpModule + class HNHNEncoderConfig(TypedDict): """ diff --git a/hyperbench/hlp/hypergcn_hlp.py b/hyperbench/hlp/hypergcn_hlp.py index ad23188..5782686 100644 --- a/hyperbench/hlp/hypergcn_hlp.py +++ b/hyperbench/hlp/hypergcn_hlp.py @@ -7,7 +7,7 @@ from torchmetrics import MetricCollection from hyperbench.utils import Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule class HyperGCNEncoderConfig(TypedDict): diff --git a/hyperbench/hlp/mlp_hlp.py b/hyperbench/hlp/mlp_hlp.py index 8d95689..807a9fa 100644 --- a/hyperbench/hlp/mlp_hlp.py +++ b/hyperbench/hlp/mlp_hlp.py @@ -7,7 +7,7 @@ from torchmetrics import MetricCollection from hyperbench.utils import ActivationFn, NormalizationFn, Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule class MlpEncoderConfig(TypedDict): diff --git a/hyperbench/hlp/node2vecgcn_hlp.py b/hyperbench/hlp/node2vecgcn_hlp.py index 944cb52..a6a8f06 100644 --- a/hyperbench/hlp/node2vecgcn_hlp.py +++ b/hyperbench/hlp/node2vecgcn_hlp.py @@ -7,7 +7,7 @@ from hyperbench.nn import HyperedgeAggregator from hyperbench.utils import Stage -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule from hyperbench.hlp.node2vec_common import ( NODE2VEC_JOINT_MODE, NODE2VEC_PRECOMPUTED_MODE, diff --git a/hyperbench/hlp/node2vecslp_hlp.py b/hyperbench/hlp/node2vecslp_hlp.py index 9c31785..38d6ed8 100644 --- a/hyperbench/hlp/node2vecslp_hlp.py +++ b/hyperbench/hlp/node2vecslp_hlp.py @@ -7,7 +7,7 @@ from hyperbench.utils import Stage from hyperbench.nn import HyperedgeAggregator -from hyperbench.hlp.hlp import HlpModule +from hyperbench.hlp.common import HlpModule from hyperbench.hlp.node2vec_common import ( NODE2VEC_JOINT_MODE, Node2VecHlpConfig,