Add server component for batched alignment calls#25
Open
robinp wants to merge 8 commits intorobertostling:masterfrom
Open
Add server component for batched alignment calls#25robinp wants to merge 8 commits intorobertostling:masterfrom
robinp wants to merge 8 commits intorobertostling:masterfrom
Conversation
added 8 commits
May 12, 2025 11:05
Not sure, but sounds logical.
Passing trust_sents=False will set n_clean=0, which (after this change) means no sentences are trusted for statistics, so prior updates don't happen. Useful for batched sending of sentences of dubious quality.
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.
Below commits add an eflomal-server binary, that can be started after activating the virtualenv (or after packaging and installing). It by default looks for a server_config.json file that describes a list of aligners, as determined by their prior files.
Then a JSON call can be made (see the shell script in devscripts directory for example) to a specified aligner, with one or more sentence pair passed. A sentence can either be a string, or a list of tokens.
The endpoint also takes optional parameters, for example scoring can be disabled; model updates can be disabled; iterations per model can be specified.
The server mode preloads and preprocesses the priors, so subsequent API calls are reasonably fast. The calls still operate as eflomal binary executions, but the exec overhead is not significant compared to the alignment computation itself. NULL priors are not supported, but comments are left where they could be added.
Other notable changes:
Bugfix (?): calculate_priors in reverse mode didn't reverse the pairs, fixed that.