fix: don't crash the quantile token loss when no kernel is configured#9
Open
brettbj wants to merge 1 commit into
Open
fix: don't crash the quantile token loss when no kernel is configured#9brettbj wants to merge 1 commit into
brettbj wants to merge 1 commit into
Conversation
aggregate_first/loss_first read cfg.quantile_token_loss.kernel.type unconditionally, so the shipped config/main.yaml (quantile_token_loss without a kernel block) raised ConfigAttributeError on the first training step; a kernel block without 'factor' likewise left self.kernel_factor unset and raised AttributeError later. Resolve kernel_type (default 'linear') and kernel_factor (default 1.0) once in __init__ and reference only those attributes in the loss functions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
if it hits this and kernel is not set, we might actually want it to crash rather than defaulting to linear without us knowing? |
Contributor
|
This was part of the reason I started working off the https://github.com/bbj-lab/cotorra/tree/coreopsis-stable branch |
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.
How to recreate
Train with the shipped
config/main.yaml(it setscustom_loss: trueand aquantile_token_lossblock without akernelkey). The first training stepraises
omegaconf.errors.ConfigAttributeError: Key 'kernel' is not in structfrom
aggregate_first.Why it's a bug
Loss.__init__carefully guards kernel handling (if "kernel" in self.cfg.quantile_token_loss: ...), but both inner loss functions readself.cfg.quantile_token_loss.kernel.typeunconditionally. Additionally, akernelblock withtypebut nofactorleftself.kernel_factorunset, raisingAttributeErrorat first use. The default config shipped in this repo hits the first path.How it was fixed
Resolve
kernel_type(default"linear") andkernel_factor(default1.0) once in__init__viacfg.get(...)and reference only those attributes insideaggregate_first/loss_first. The linear kernel is the identity, so the defaults preserve previous intended behavior. Verified a forward pass ofquantile_token_losswith the kernel-less config now returns a finite loss.🤖 Generated with Claude Code