HGCN API¶
The separate graph refinement stage retains its graph curriculum, triplet objective and curvature utilities. The text model has its own objective and monitor.
CurriculumState
dataclass
¶
Lightweight container for future curriculum features (Issues #62/#63).
HGCNLightningModule
¶
Bases: LightningModule
PyTorch Lightning module for single-stage HGCN training.
get_final_embeddings()
¶
Compute export embeddings with dropout disabled.
Lightning leaves the module in training mode after fit, so the pass runs in eval mode
and then restores each submodule's prior mode.
HyperbolicConvolution
¶
Bases: MessagePassing
Hyperbolic graph convolution with edge-aware attention.
Steps
- Map hyperbolic features to tangent space
- Apply linear projection
- Edge-aware attention with learnable relation embeddings
- Residual + LayerNorm
- Map back to hyperboloid
load_embeddings(parquet_path, device, *, embedding_prefix=STAGE3_EMBEDDING_PREFIX)
¶
Load hyperbolic embeddings from parquet file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parquet_path
|
str
|
Parquet with a |
required |
device
|
device
|
Device for the returned tensors |
required |
embedding_prefix
|
str
|
Embedding column prefix, |
STAGE3_EMBEDDING_PREFIX
|
Returns:
| Type | Description |
|---|---|
Tuple[Tensor, Tensor, DataFrame]
|
Embeddings in numeric column-suffix order, levels, and the full DataFrame |
main(config_file='conf/graph.yaml')
¶
Main entry point for single-stage HGCN training via PyTorch Lightning.
triplet_loss_hyp(emb, anchors, positives, negatives, margin, temperature=1.0, c=1.0, negative_weights=None)
¶
Triplet loss with temperature scaling for curriculum learning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temperature
|
float
|
Scale factor for loss (lower = sharper gradients) |
1.0
|