Fix: honour instance-level Wapiti params in train() and add -modelPath CLI arg#1383
Merged
lfoppiano merged 3 commits intoMar 6, 2026
Merged
Conversation
…ter overrides train() (mode 0) was always reading epsilon, window and nbMaxIterations from GrobidProperties, silently ignoring any values set via setParams(). Modes 2 and 3 already used the instance fields as overrides; mode 0 now follows the same pattern, falling back to the config value when the instance field is at its default zero. Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
Fixes cboulanger#2 —
AbstractTrainer.train()(mode 0) previously ignored any Wapiti parameters set viasetParams()and always read them fromGrobidProperties. This PR completes the fix in two parts:1. Fix
AbstractTrainer.train()to honour instance-level Wapiti parameter overridessplitTrainEvaluate()(mode 2) andnFoldEvaluate()(mode 3) already used instance fields as overrides. Mode 0 now does the same:Fully backwards-compatible: when
setParams()has not been called, the instance fields default to0/0.0and config values are used as before.2. Expose Wapiti parameters and custom model output path via
TrainerRunnerCLITrainerRunner(the JAR entry point) never calledsetParams(), so the fix above was unreachable from the command line. New optional flags:-epsilondouble-wint-maxIterint-modelPathpathWhen
-modelPathis provided:.new/.oldatomic rename).-modelPath) is unchanged.Use case
Enables callers constructing a trainer programmatically or via CLI/HTTP to supply runtime Wapiti parameters and write versioned/test model files without modifying
grobid.yaml.Affected files
grobid-trainer/src/main/java/org/grobid/trainer/AbstractTrainer.javagrobid-trainer/src/main/java/org/grobid/trainer/TrainerRunner.java🤖 Generated with Claude Code