Conversation
Move generic training logic to EmbeddingELModel base class, allowing subclasses to customize behavior through hooks instead of duplicating the entire training loop. New customization hooks in EmbeddingELModel: - get_negative_sampling_config(): Configure which GCIs need negatives - generate_negatives(): Custom negative sampling strategy - compute_loss(): Custom loss computation (e.g., MSE loss for ELBE) - get_regularization_loss(): Add regularization from module - get_optimizer(): Use different optimizer API changes: - epochs parameter moved from __init__() to train() - Subclasses now only need to implement init_module() and override hooks as needed Models simplified: - ELBE: Only overrides compute_loss() for MSE loss - ELEmbeddings: Uses base class entirely (has regularization) - BoxSquaredEL: Uses base class entirely (has regularization) Example models updated to use new API: - ELBEPPI, ELBEGDA - ELEmPPI, ELEmGDA - BoxSquaredELPPI, BoxSquaredELGDA Code reduction: ~640 lines removed, ~450 lines added (net -190 lines) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove gci2 as the implicit default evaluation method in EmbeddingELModel. Users must now explicitly set model.eval_gci_name before training with validation or calling eval_method(), enabling evaluation on any GCI type (gci0, gci1, gci2, gci3, etc.). - Add eval_gci_name property with validation in EmbeddingELModel - Update train() to require eval_gci_name when validation is used - Update eval_method() to use configured GCI type instead of hardcoded gci2 - Update all example models (ELEmbeddings, ELBE, BoxSquaredEL) to set eval_gci_name="gci2" in their __init__ methods - Update tests to explicitly set eval_gci_name Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move generic training logic to EmbeddingELModel base class, allowing subclasses to customize behavior through hooks instead of duplicating the entire training loop.
New customization hooks in EmbeddingELModel:
API changes:
Models simplified:
Example models updated to use new API:
Code reduction: ~640 lines removed, ~450 lines added (net -190 lines)